Calculation Help
-
Hello! First of all I want to thank you for this awesome plugin!
But anyway I need your help with the equation.
http://puu.sh/pfeFY/4f9ad58e22.png
In the screenshot above I have illustrated how the price is calculated.
“715” is the default value(price) and is being multiplied to different coefficients from the other boxes(fieldnames).
The strokes with arrows are dependencies.
I hope that you understand how the graph is organized.
Thank you in advance.
-
My example is a little bit complex, but I hope you can give me a solution.
Regards, Andrei.
Hi,
Your screenshot illustrates the way your dependencies are defined but not the structure of the equations.
If you need a custom coding service, do not hesitate in contact me through my private support page with a detailed description of your project (not only the screenshot)
http://cff.dwbooster.com/customization
Best regards.
Hi, thank you for reply!
I was hoping that you understand the structure of equations.
Can I explain you how a price is calculated?
Example 1:
We select the first box from the top from fieldname1.
715 * 0.7(fieldname2) * 1.4(fieldname7) * 0.9(fieldname8) * 1.0(fieldname10) * 1.0(fieldname11) * 1.2(fieldname12) = final price.Example 2:
We select the third box from the top from fieldname1.
715 * 0.9(fieldname4) * 1.0(fieldname7) * 1.5(fieldname8) * 1.2(fieldname9) = final price.Example 3:
We select the last box from the top from fieldname1.
715 * 1.5(fieldname6) * 0.9(fieldname7) * 0.9(fieldname8) * 1.2(fieldname10) = final price.Hi,
I will try to explain the process with an example. If the values of the choices in the fieldname1 are: first choice ‘A’, second choice ‘B’, and the third choice ‘C’, the equation should use conditional statements, as follows:
(function(){ if(fieldname1=='A') return 715*0.7*fieldname2*1.4*fieldname7*0.9*fieldname8* 1.0*fieldname10*1.0*fieldname11*1.2*fieldname12; if(fieldname1=='B') return 715*0.9*fieldname4*1.0*fieldname7*1.5*fieldname8*1.2*fieldname9; if(fieldname1=='C') return 715*1.5*fieldname6*0.9*fieldname7*0.9*fieldname8*1.2*fieldname10; })()Be sure to use all multiplication symbols, for example:
1.2(fieldname10) is incorrect, the correct is: 1.2*fieldname10
Best regards.
Thank you very much, I will try now and see if it works.
1.2(fieldname10) – I mentioned the coefficient 1.2 from fieldname10(in my case the dropdown).
One more question, in the equation field I need to insert all the possible examples?
I think your examples are correct, but they are only working for that concrete scenarios.
In my case I need a general formula how to multiply different coefficients from differents fieldnames(dropdowns).
Hi,
I’m not sure about your form’s structure, however, if the values to use in the equations are the values of the choices of fields, you simply should multiply the fields in the form, and won’t be needed to use conditional statements.
Best regards.
Mate I have a problem, I have added a formula in the equation field that is working for a part of my calculator:
prec((fieldname2*fieldname4*fieldname9*fieldname10*fieldname16),2)
Now how can I add another formula in the same equation field?
http://puu.sh/pftbt/a9b6b5b425.png
In my screenshot you see 2 formulas but now the calculator is not working, if I leave only 1 formula everything is working.
Thank you in advance.
Buddy I have a little problem:
http://puu.sh/pftbt/a9b6b5b425.png
In the screenshot you can see 2 formulas, but something is not working properly, if I delete the last formula, everything is working fine.
I think that I am missing something that is causing errors between the equations.
Thank you in advance.
Hi,
If the equation associated to a calculated field has separated operations, you should use a conditional statement to select the operations to apply, and return the result:
(function(){ if(...) return PREC(fieldname2*fieldname4*fieldname9*fieldname10*fieldname16,2); return PREC(fieldname2*fieldname4*fieldname9*fieldname10*fieldname14,2); })()of course, in the previous equation should be replaced the symbols … by the condition to check.
Best regards.
http://puu.sh/pghRz/24ccf096a8.png
(function(){
return PREC(fieldname2*fieldname4*fieldname9*fieldname10*fieldname16,2);
return PREC(fieldname2*fieldname4*fieldname9*fieldname10*fieldname12,2);
return PREC(fieldname2*fieldname4*fieldname9*fieldname10*fieldname13,2);
})()I have a little problem, in the 2nd and 3rd equation the fieldname12 and fieldname13 are not being multiplied.
Fieldname11 and Fieldname14 I do not include as there choices have 1.0 coefficient.
The first equation is working properly, but the other ones are being multiplied till Fieldname10.
I do not understand where is my mistake here.
Hi,
In javascript, the instructions below a “return” statement are not reached, so, your function is returning in the first “return” statement.
Could you describe your equation, please?
For example, if the fields: fieldname16, fieldname12, and fieldname13 are dependent fields, if they are not active, their values are zero, in whose case the equation can be implemented simply as follows:
PREC(fieldname2*fieldname4*fieldname9*fieldname10*(fieldname16+fieldname12+fieldname13),2)and that’s all.
Best regards.
Fieldname4, Fieldname5, Fieldname6, Fieldname7, Fieldname8 are dependent on Fieldname2.
Fieldname16(hidden) is dependent on second value(choice) from Fieldname10.
Fieldname14 is dependent on first value(choice) from Fieldname10.
Fieldname11 is dependent on first value(choice) from Fieldname14.
Fieldname12 is dependent on first value(choice) from Fieldname11.
Fieldname13 is dependent on second value(choice) from Fieldname11.
The topic ‘Calculation Help’ is closed to new replies.