CalcBuilder Forum

run 2 ot more code

User zen11t 2018-01-09 18:41:55

Hi!

How can I make that user choose e.g. a country and run a specific code, but when choose an another then calc use another code?

Thanks for the help,
Zen11t

Edited by zen11t - 09.01.2018 18:42

Moonsoft support 2018-01-09 18:46:45

Hi,
you can introduce conditional expressions at your code, let's say your field variable is
country

and you have different values at your option 'value' field, for ex

USA
Germany
Spain

at the code you can run different calculations using 'if' structure:

if($country=="USA"){

//this section of code will only be used if country=USA

}
if($country=="Spain"){

//this section of code will only be used if country=Spain

}

..etc

Hope this helps, regards

User zen11t 2018-01-11 17:56:14

Thank you very much.

Zen11t

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!