Support » Plugin: Calculated Fields Form » Multiplying A Value With A Range

• Resolved ckourounis

(@ckourounis)

Hello,

I am looking to multiple my first value with a dropdown field. 2 of my dropdown fields have a range (4-8) so when it does the calculations, it isn’t calculated at all. How can I display the calculation so it shows the range?

Page the calculator is on: https://inlandempireraw.com/faqs/

Example of a working calculation:
Value 1 x Value 2 = Answer
Value 1 = 5
Value 2 = 2%

Example of a non-working calculation:
Value 1 = 5
Value 2 = 4%-8%
Answer = Null —- It should be displayed as 0.2 – 0.4

• This topic was modified 2 years, 2 months ago by ckourounis.

Viewing 3 replies - 1 through 3 (of 3 total)
• Plugin Author codepeople

(@codepeople)

Hello,

I’m sorry, but there is not no way to infer what you pretend calculate if you don’t implement the behavior you want get.

First, edit the values of last options of dropdown field as follows:

0.045-0.08
0.04-0.08

``````(function(){
var f2 = fieldname2,
f3 = (new String(fieldname3)).split('-');
if(f3.length == 1)
{
return PREC(f2*f3,2)
}
else
{
return PREC(f2*f3[0],2)+'-'+PREC(f2*f3[1],2)
}
})()``````

I’m sorry, but the support service does not cover the implementation of the users’ projects (forms or formulas). If you need additional help implementing your equations I can offer you a custom coding service through my private website:

https://cff.dwbooster.com/customization

Best regards.

ckourounis

(@ckourounis)

Thank you for the information. I can implement the code on my own. I have changed the values in the dropdown as you mentioned, but where do I put the code you provided? Does it go in any particular file?

``````(function(){
var f2 = fieldname2,
f3 = (new String(fieldname3)).split('-');
if(f3.length == 1)
{
return PREC(f2*f3,2)
}
else
{
return PREC(f2*f3[0],2)+'-'+PREC(f2*f3[1],2)
}
})()``````
• This reply was modified 2 years, 2 months ago by ckourounis.
ckourounis

(@ckourounis)

Ohh sorry it goes into “Set Equation” field. Wow that’s a very complex equation. Thank you for all of the help. I’m rating the plugin 5 stars for how technical it can allow us to set an equation and because of the great support ðŸ™‚

• This reply was modified 2 years, 2 months ago by ckourounis.
Viewing 3 replies - 1 through 3 (of 3 total)
• The topic ‘Multiplying A Value With A Range’ is closed to new replies.