Hi @raschmann,
Assuming that the field with the choices is the fieldname123, the equation should be modified as follows:
(function(){
if(fieldname123 == 1) return prec(fieldname1+(13.7 * fieldname3)+(5 * fieldname2)-(6.8 * fieldname5),2);
if(fieldname123 == 2 ) return prec(fieldname1+(9.6 * fieldname3)+(1,8 * fieldname2)-(4.7 * fieldname5),2);
})()
or simply:
IF(fieldname123 == 1, prec(fieldname1+(13.7 * fieldname3)+(5 * fieldname2)-(6.8 * fieldname5),2), prec(fieldname1+(9.6 * fieldname3)+(1,8 * fieldname2)-(4.7 * fieldname5),2))
Best regards.
Thanks a lot for your help! It´s always nice to see such a great support!
Unfortunately I can´t get it done…I´ve tried both of your formulas…the second one is coming up with a wrong result…
Your first formula is giving me a blank result field.
So…maybe you can have another look at it:
“fieldname1” is giving the user 2 choices: MAN or WOMAN…if you chose MAN the value is “66.47”, if you chose WOMAN the value is “655.1”.
Depending on what you chose, the calculation should grab the value and put it in line with some other numbers.
If you chose MAN (the first choice) the calculation is:
prec(fieldname1+(13.7 * fieldname3)+(5 * fieldname2)-(6.8 * fieldname5),2)
If you chose WOMAN (the second choice) the calculation is:
prec(fieldname1+(9.6 * fieldname3)+(1.8 * fieldname2)-(4.7 * fieldname5),2)
fieldname1 is either 66.47 for MAN or 655.1 for WOMAN
fieldname 2, 3 and 5 are simple numbers…
I am going crazy because I really can´t find the solution…
Hi,
In this case you should edit the equation as follows:
IF(fieldname123 == ‘MAN’, prec(fieldname1+(13.7 * fieldname3)+(5 * fieldname2)-(6.8 * fieldname5),2), prec(fieldname1+(9.6 * fieldname3)+(1,8 * fieldname2)-(4.7 * fieldname5),2))
Please note, I’m using a hypothetical field: fieldname123, you should modify the equation to your form, however, if the field with the texts: MAN and WOMAN is the fieldname1, as it is a text, you cannot use the field in the mathematical operation.
Best regards.
Thank you very much for your amazing support! I really appreciate your help!
Unfortunately it´s still not working…
So if I have fiedname1 with two choices “MAN” and “WOMAN”…and each one is having a different VALUE…is it not possible to use that value for two different combinations?
Like if I chose “MAN” the formula grabs the VALUE and put it into formula A…
If I chose “WOMAN” the formula grabs the other VALUE and put it into a different formula…
As you know, depending on the choice of fieldname1 the formula changes…
Is there any way to do it on an easier way? Like replacing the dropdown menu with a picker or anything?
Again thanks a lot…I owe you! Should send you some tip via paypal!
Hi @raschmann,
All solutions in the previous tickets are implementations of the behavior you are needing, for example: Assuming that the fieldname1 is a dropdown, or radio field, whose choices have the texts: MAN and WOMAN and the values, 123 and 567 respectively, the equation should be modified as follows:
IF(fieldname1 == 123, prec(fieldname1+(13.7 * fieldname3)+(5 * fieldname2)-(6.8 * fieldname5),2), prec(fieldname1+(9.6 * fieldname3)+(1,8 * fieldname2)-(4.7 * fieldname5),2))
Of course, you should replace the value 123 by the corresponding value of the “MAN” choice. Pay attention, I’m comparing with the values of the choices and not with the texts.
Best regards.