Hello,
There are multiple issues in your equation:
– First, in javascript, the decimal symbol is the dot (.), and not the comma (,). So, the correct representation would be: 266.6666666666667, and not: 266,6666666666667
– Second, if the first condition is:
fieldname3 < 266.6666666666667 with a return statement,
and the second one is:
fieldname3 > 266.6666666666667 with a return statement,
Both conditions cover all the spectrum so, the rest of the equations won’t be reached.
So, the equation should be edited as follows:
(function () {
if (fieldname3 < 266.66)
return fieldname7;
else if (fieldname3 <= 2500 )
return fieldname3 * 0.15;
else if (fieldname3 <= 5000)
return fieldname3 * 0.10 + 375;
else if (fieldname3 <= 10000)
return fieldname3 * 0.05 + 625;
else if (fieldname3 <= 200000)
return fieldname3 * 0.01 + 875;
return MIN(fieldname3 * 0.005 + 2775, 6775);
})()
If you need additional help with your equation, I can offer you a custom coding service, from my personal website:
http://cff.dwbooster.com/customization
Best regards.
Thanks! This is great, its finally working! You’re really good!
-
This reply was modified 8 years, 7 months ago by
alexvds.
-
This reply was modified 8 years, 7 months ago by
alexvds.
I have one last question about this. Ofcourse it shows now always fieldname7 because there is no input (so the amount is in the beginning always beneath € 266.66). Is there a possibility to clear the fieldname in te case there is no input yet?
Hello,
You will need something similar to:
(function () {
if(fieldname3){
if (fieldname3 < 266.66)
return fieldname7;
else if (fieldname3 <= 2500 )
return fieldname3 * 0.15;
else if (fieldname3 <= 5000)
return fieldname3 * 0.10 + 375;
else if (fieldname3 <= 10000)
return fieldname3 * 0.05 + 625;
else if (fieldname3 <= 200000)
return fieldname3 * 0.01 + 875;
return MIN(fieldname3 * 0.005 + 2775, 6775);
}
return '';
})()