HI i wanted to know how to put multiple conditions with a single formula on ERPNEXT version 12.
Component 1: if base is greater than or equal to 5,000 but less than or equal to 10,000 then base * 0.01
Component 2 if base is greater or equal to than 10,001 but less than or equal to 15,0000 then base * 0.02
How can i express these condition on the salary structure? Kindly assist.
Maybe relate what you have found and learned from your experiments to achieve this?
@clarkej I have created a salary structure with those 2 components but i have noticed that ones i generate my salary slip, the conditions are not being processed as i expected.
For this i put the condition as 10000<=base>=5000 and formula as base*0.01
For this i put the condition as 15000<=base>=10,001 and formula as base*0.02
From the above example if the base salary is 12,000 i dont expect component 1 to be processed as the condition is not met, only component 2 should be processed. Unfortunately this is not happening.It actually processes component 1 and leaves out component 2.
Are my conditions in the examples correct or is there something am missing. also am using base to be my basic salary.
Maybe try this approach?
“adding multiple rows of the same component, but different condition.”
Reference Salary Structure Multiple Condition
edit: For ideas try a search like this
"@Tufan_Kaynak2 salary conditions"
@clarkej Thanks. This makes more sense. In the example i have shared with you, how can i break component 1 into different components. Kindly give me a sample example. I will highly appreciate
Short of doing this trial and error myself, perhaps someone is willing to share…
Try this if it works:
base * 0.01 if (base >= 5000 and <= 10000) else base * 0.02 if (base >= 10001 and <= 15000)
You don’t need to create 2 different components if the salary component is the same.
I have done exact formula and I got error.
Syntax error in formula or condition: invalid syntax (, line 1)
what else should I set up to get this done? I am missing something?
I guess that the condition is expecting one last else.
my solution was like this.
base * 0.01 if (base >= 5000 and <= 10000) else base * 0.02 if (base >= 10001 and <= 15000) else 0
Yes, you are right it requires one more else. Did this work for you?
this one worked, as @clarkej wrote.
This also worked for me.
base * 0.01 if (base >= 5000 and base <= 10000) else base * 0.02 if (base >= 10001 and base <= 15000) else 0
Thanks alot guys. So much appreciated.