Salary Structure Multiple Condition

Hi! I’m new here. I have a question regarding salary component. I tried to put multiple condition on the deduction section and then I received an error with the conditions i wrote. Capture

Can you try write it as follow:
4.5 if base >2200 and base<2301 else 4.7 if base >2300 and base<2401

1 Like

i will receive a syntax error if i write like that. I found another solution by adding multiple rows of the same component, but different condition. Anyway, thank you so much for the help :blush:

Hi Sir,
Could you please tell me the solution you found.

1 Like

I had the same issue, be sure that you wrote all code in one simple line, u cannot indent or make it in multiple lines, and always have one last else.

try this:

4.5 if (base >2200 and base<2301) else 4.7 if (base >2300 and base<2401) else 0

You can put multiple lines in the Formula box, just be sure to put a space character (by pressing the Space Bar) at the end.

CORRECT MULTICONDITION IN SALARY COMPONENT ENTERED IN FORMULA SECTION

SINGLE LINE ONLY:
400 if base>19749.99 else int((base+500-2249.99)/500)*10+40 if base>2249.99 else 40

or

MULTIPLE LINES:
400 if base>19749.99 else
int((base+500-2249.99)/500)*10+40 if base>2249.99 else
40

VERY IMPORTANT NOTES:

  1. In multiple lines, there is space character after else. This is the error that took me days to check.
  2. There is no IF on the last line.
  3. Multiple conditions does not work on the Conditions box, I don’t actually use it anymore. I put everything in the Formula box.
3 Likes