Hello @mrdude23
The project’s can be implemented easily with the slider control. As you have defined the step equal to 30, the possible values of the slider are : 30, 60, 90, 120, 150 and 180
So, assuming the slider field is fieldname1, and the basic equation: fieldname2+fieldname3
The equation should be edited as follows:
(function(){
var result = fieldname2+fieldname3,
duration = fieldname1;
if(duration == 30) return result;
if(duration == 60) return result*0.5;
if(duration == 90) return result*0.4;
})()
Now, you simply should to include the other conditional statements.
Best regards.
Wow, that was fast. It works perfectly. Thank you so much!
Hello! I ran into another problem 🙁
I’m trying to put another Checkbox option into the equation from above. Basicly: If checked the result should ad another 20%, if not, nothing happens. The easiest way would be to multiply by fieldname8, but if not checked fieldname8 is 0. I tried putting another if into the equation, but nothing changes.
(function(){
var result = fieldname3+fieldname8,
duration = fieldname4;
percent = fieldname7;
if(duration == 30) return result;
if(duration == 60) return result*1.5;
if(duration == 90) return result*1.9;
(…)
if(percent == 0) return result;
if(percent == 1.2) return result*1.2;
})()
I’m quite shure I’m not that far off. But where? 😀
Hello @mrdude23
The solution would be simpler, and alternative would be:
(function () {
var result = fieldname3 + fieldname8,
duration = fieldname4,
n = 1;
if (duration == 60) n = 1.5;
if (duration == 90) n = 1.9;
n += fieldname7;
return result*n;
})()
Best regards.
Thanks a bunch! It actually didn’t quite work for me, but I found my way. Your equation added another 20% to the basic result. I wanted to add 20% to the end result. I fixed it by adding
g = 1;
(…)
if(fieldname7 == 1) g = 1.2;
return result*n*g;
Now it adds another 20% to the final result.
Thank you very much for your help!
-
This reply was modified 5 years, 8 months ago by
mrdude23.
Hello @mrdude23
Thank you very much for sharing your solution.
Best regards.