Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calculate two sums from a single column of 40 fields based on a checkbox beside each field_SOLVED

Community Beginner ,
Oct 05, 2019 Oct 05, 2019

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

TOPICS
PDF forms
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Beginner ,
Oct 06, 2019 Oct 06, 2019

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

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2019 Oct 05, 2019

Are you trying to calculate empty versus loaded if an apportionment percentage is applied by state?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 05, 2019 Oct 05, 2019
No, just empty miles and loaded miles. I've figured the total miles using "pick" in that field's calculate properties.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2019 Oct 05, 2019

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 05, 2019 Oct 05, 2019

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2019 Oct 05, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2019 Oct 05, 2019
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 06, 2019 Oct 06, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 06, 2019 Oct 06, 2019
That is great! don't forget to mark your answer as correct
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 06, 2019 Oct 06, 2019
I don't see how. I'm new to this forum.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 06, 2019 Oct 06, 2019
Well, hopefully a moderator will swing by to review this thread and mark as correct.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 06, 2019 Oct 06, 2019
LATEST
I edited the title by adding "SOLVED".
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 06, 2019 Oct 06, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines