Copy link to clipboard
Copied
Hi! I have a simple calculation that pulls from two different fields. The first field is ALWAYS filled out, and the second field is only filled out once in a while. But if the second field IS filled out, then the info in the first field isn't the correct variable for the calculation, and I need the number from the second field.
For example:
Field 1 = 3
Field 2 = "blank"
Calculation Field is:
Field 1 * 1.25 (or 3 * 1.25 = 3.75)
But if the user does this:
Field 1 = 3
Field 2 = 4
Then the calculation field is:
Field 2 * 1.25 (or 4 * 1.25 = 5)
However, I can't keep one visible and hide the other (I think) because I still need the data in Field 1 to still be seen. Is there a code I can add to the "Custom Calculation Script" section of the "Text Field Properties" box?
You can use this code:
var fld1 = this.getField("Field1").value;
var fld2 = this.getField("Field2").value;
if(fld2 != ""){
event.value = fld2*1.25;}
else event.value = fld1*1.25;
Copy link to clipboard
Copied
You can use this code:
var fld1 = this.getField("Field1").value;
var fld2 = this.getField("Field2").value;
if(fld2 != ""){
event.value = fld2*1.25;}
else event.value = fld1*1.25;
Copy link to clipboard
Copied
Perfecto! Thank you so much NesaNurani. ❤️