Copy link to clipboard
Copied
Hi,
I just need to create a calculation in which, in column A (Número de tarjetas a almacenar) you have a list of options to be selected. Depending on the option you select, the price is shown on column B.
Just with this, I would be really happy :-).
An aditional question is if I can determine as an exeption that if you select the last option "Más de 10000", then the price "Coste mensual" is calculated with a formula which is a number from another box* 3
Many thanks!
OK. As the custom calculation script of the text field you can enter something like this:
var v = this.getField("Número de tarjetas a almacenar").valueAsString;
if (v=="0 - 300") event.value = "8€";
else if (v=="300 - 600") event.value = "11€";
else if (v=="600 - 1000") event.value = "15€";
// etc.
Copy link to clipboard
Copied
You need to provide the full details of which value should appear in the text field for each of the values selected in the drop-down.
Copy link to clipboard
Copied
0 - 300 8€
300 - 600 11€
600 - 1000 15€
1000 - 3000 35€
3000 - 5000 60€
5000 - 10000 100€
Mas de 10.000 Precio personalizado
Thanks!
Copy link to clipboard
Copied
OK. As the custom calculation script of the text field you can enter something like this:
var v = this.getField("Número de tarjetas a almacenar").valueAsString;
if (v=="0 - 300") event.value = "8€";
else if (v=="300 - 600") event.value = "11€";
else if (v=="600 - 1000") event.value = "15€";
// etc.
Copy link to clipboard
Copied
Thank! It works!
Copy link to clipboard
Copied
One last thing. How can I say if a value from column A is greater than 10000 then multiply by 0,03?
Thanks!!
Copy link to clipboard
Copied
Multiply what, exactly?
Copy link to clipboard
Copied
So basically if I write a number higher than 10000 on column A multiply it by 0,03 on column B. Otherwise write "Not valid" on column B
Copy link to clipboard
Copied
Is "Column A" the drop-down field? If not, what is the name of that field, and that of Column B?
Copy link to clipboard
Copied
No drop down as I had to separate 1 range.
Column A field is called "ServiciosPlus-Tarjetasincluidas10000"
Column B is the calculation destination, called "ServiciosPlus-Coste10000"
Whatever value I put in column A needs to be multiplied by 0,03 except if it is under 10000 (if that´s the case a "Not valid" message should be shown
thanks!!
Copy link to clipboard
Copied
OK, then use this code as the custom calculation script of the second field:
var v = Number(this.getField("ServiciosPlus-Tarjetasincluidas10000").valueAsString);
if (v<10000) event.value = "Not valid";
else event.value = v * 0.03;
Copy link to clipboard
Copied
Thanks again!