Copy link to clipboard
Copied
I have a form that has 27 different fields that have $$ amounts in them. I need to add them all up to create a sum, but if the sum exceeds $5000, I need it to only show $5000 - no higher. I've tried many different forums and suggestions online, but can't seem to knock this one out. This is literally the last field I need for this document. Can anyone assist?
Copy link to clipboard
Copied
There is an easier way to achieve this, use built in 'sum' option in the total field, under 'calculate' tab select 'Value is the' leave as sum(+) and pick your fields, in 'Validate' tab enter this script:
if(Number(event.value) > 5000)event.value = 5000;
Copy link to clipboard
Copied
Create a custom calculation script like this:
var total=
Number(this.getField("Field1").valueAsString)+
Number(this.getField("Field2").valueAsString)+
Number(this.getField("Field3").valueAsString)+
Number(this.getField("Field4").valueAsString)...etc.
if(total > 5000)
{event.value=5000}
else
{event.value=total}
If you're fields have a specific consistent naming convention with numbers, you might be able to avoid typing out every field name into the script.
Copy link to clipboard
Copied
There is an easier way to achieve this, use built in 'sum' option in the total field, under 'calculate' tab select 'Value is the' leave as sum(+) and pick your fields, in 'Validate' tab enter this script:
if(Number(event.value) > 5000)event.value = 5000;
Copy link to clipboard
Copied
This worked beautifully! I knew there was a simple answer to this! I apprecaite your help!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more