Copy link to clipboard
Copied
I need to compare the sum of fields 1,2,3 (sum#A) and compare it to field 4 (sum#B) and put the greater of sum A and B into field 5. I am a newbie at this and need to know if there is a way to do that. Thank you for all of your great support.
Copy link to clipboard
Copied
Place in calculation script of the field #5:
event.value=this.getField("sum#A").value>=this.getField("sum#B").value ? this.getField("sum#A").value : this.getField("sum#B").value;
@+
Copy link to clipboard
Copied
I think I asked the wrong question. After some thought I really need this: I need to compare the values of two sets of 3 fields: the sum of 3 "priority" (P-1, P-2, P-3) fields and the sum of the 3 "non-priority" fields NP-1, NP-2, NP-3. If sum of the priority fields (P-1+P-2+P-3) are greater than the non-priority fields, then I need to set the field "NP-total" to 0 . Sorry for misstating the problem.
Copy link to clipboard
Copied
I tried this but it does not work
{if (this.getField("2ea3").value>=this.getField("total_NP_uns").value) {
event.value = 0}}
where the 2ea3 field is the total priority (P-1, P-2 P-3) and the total_NP_uns) is the NP fields. The trigger to 0 does not work.
Copy link to clipboard
Copied
Where does you use the script?
Copy link to clipboard
Copied
In calculation script of the "total_NP_uns" field:
event.value=this.getField("NP-1").value+this.getField("NP-2").value+this.getField("NP-3").value;
and in validation script of this same field:
event.value=this.getField("2ea3").value>=event.value ? this.getField("2ea3").value : 0;
@+
Copy link to clipboard
Copied
You don't need any JavaScript for doing this, just use the "Maximum" Acrobat's calculation:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now