Copy link to clipboard
Copied
Hi,
I need to create a function to find the difference between the values of 2 cells in each particular row in my interactive form.
The names of the two cells are 'From1' and 'To1'.
Under the calculation function, the functions available are only limited to sum, product, average, max, min.
I tried to use the simplified field notation by entering the following statement:
From1 - To1
I achieved no success.
Appreciate if someone can help me on this.
Thank you
Copy link to clipboard
Copied
That should have worked. You will need to change the value of one of the fields for it to "kick in", though.
If it still doesn't work check the JS Console (Ctrl+J) for error messages.
Copy link to clipboard
Copied
If you just want to show difference between 2 fields in 3rd field you can try this as custom calculation script in 3rd field.( rename the names of the fields in code if needed)
var a = this.getField("From1").value;
var b = this.getField("To1").value;
if (a > b || a == b){
this.getField("Difference").value = a-b;
}
if (a < b){
this.getField("Difference").value = b-a;
}
Copy link to clipboard
Copied
1. Be sure that From1 and To1 uses the "Number" format.
2. In simplified notation, if ever fields names uses dots or blank spaces they must be escaped with a backslash:
From\.1 - To\ 1
Find more inspiration, events, and resources on the new Adobe Community
Explore Now