Copy link to clipboard
Copied
I have 40 rows, each containing 8 fields and one checkbox, as follows:
Date, BOL, State, Stateline Road, OdometerBegin, Route, OdometerEnd, Miles by State, checkbox (check if loaded)
There are three fields at the bottom for the results I need; loaded miles, empty miles, and total miles.
Total miles is easy, it's the loaded and empty miles I can't seem to figure out.
From the column of fields Miles by State (rows 1-40), I need to calculate loaded miles and empty miles.
The checkbox I used hoping to determine if loaded or empty for the calculation.
I've been at this all day and am stumped.
I'm open to suggestions to revise the form if I've made it too complicated. It's a work in progress.
Acrobat DC, latest version
Form attached
Thanks, Jason
Copy link to clipboard
Copied
CORRECT ANSWER, for me anyway
Here's what I found worked for me, at my level of Acrobat DC JS understanding:
I twice duplicated the MilesByState column of fields, naming those new fields MilesByStateLoaded & MilesByStateEmpty. I placed a script in the calc properties of each field to populate from MilesByState based on the checkbox Off or On. The calc to TotalLoaded Miles & TotalEmptyMiles was easy. It may have been the long way around, but it works!
Thanks to all who helped.
Jason
Copy link to clipboard
Copied
Are you trying to calculate empty versus loaded if an apportionment percentage is applied by state?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
So what you need is to totalize the loaded miles, for example, when the user user checks the box , and calculate empty miles automatically if the box is unckecked?
Have you considered using radio buttons instead? I think I have a miniscript that can help in both cases (radio button or checkbox)
Copy link to clipboard
Copied
Exactly! Using checkboxes now, haven't considered radio buttons. I believe either would work.
I thought of another solution:
Duplicate the miles by state column x2; rename one for loaded, one for empty. The checkbox/radio button can determine which gets poulated, loaded or empty. Simple calc after that. Those fields can remain hidden and not printed.
Copy link to clipboard
Copied
Hello again,
So check this thread : https://community.adobe.com/t5/Acrobat/how-to-add-gst-calculation-based-on-selection-from-radio-butt...
This is something that worked for me trying to help another user with a similar issue but using radio buttons.
The trick here is to assign an export value to the radio button and use the radio button field values as part of the custom calculation script of the text field where you want the result to be displayed.
Let me know if you need more help with the calculation script, but this should be good as template for your checkboxes or radio buttons
Copy link to clipboard
Copied
Copy link to clipboard
Copied
CORRECT ANSWER, for me anyway
Here's what I found worked for me, at my level of Acrobat DC JS understanding:
I twice duplicated the MilesByState column of fields, naming those new fields MilesByStateLoaded & MilesByStateEmpty. I placed a script in the calc properties of each field to populate from MilesByState based on the checkbox Off or On. The calc to TotalLoaded Miles & TotalEmptyMiles was easy. It may have been the long way around, but it works!
Thanks to all who helped.
Jason
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi
Click “View all replies” at the bottom of the post and you will see “Like”, “Correct Answer”, etc. Or tell us which one to mark and a moderator can do it for you.
Jane

