Support » Plugin: Calculated Fields Form » Replace Numbers with IF

• Hi thanks for the great plugin,

I want to replace the input of fieldname2 (if 0 => 1, if 1 => 1,2, if 2 => 1,4) and multiply it with fieldname1. Moreover fieldname 2 has a minumum of 0 and a maximum of 2)

`fieldname1 * (MIN(MAX(0, (IF(fieldname2 == 0) return 1) OR (IF(fieldname2 == 1) return 1,2) OR (IF(fieldname2 == 2) return 1,4),2)))`

Is there a paid option to get single scripts coded? Because my javascript knowledge is very basic.

Thank you very much,
Kevin

Viewing 2 replies - 1 through 2 (of 2 total)
• Hello @designcat

Thank you very much for using our plugin.

Javascript is a case-sensitive language. You should not confuse the “IF” operation distributed with the plugin (very similar to the IF operation in Excel) and the “if” conditional statement of Javascript.

Furthermore, the “return” instruction must be used only if the equation is implemented as a function calls: `(function(){/** The equation's code here **/})()`

Finally, in the Javascript code, if you need decimal numbers, you must use the point as the decimal symbol.

I don’t know what do you want to implement exactly. The use of the MIN and MAX operations in your equation are not doing any action.

So, the equation, at least for the way you have implemented it, should be edited as follows:

`fieldname1 * IF(fieldname2 == 0, 1, IF(fieldname2 == 1, 1.2, 1.4))`

Best regards.

Ahh ok, this worked thank you very much 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
• The topic ‘Replace Numbers with IF’ is closed to new replies.