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

Custom calculations in an interactive PDF scale/checklist?

Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Hello community!

 

I am looking to achieve a few custom calculations within a interactive PDF scale/checklist.

 

I've attached an annotated image attached to better explain the type of calculations I'm looking to do, but here is a written summary too:

 

1.) Have a specific field sum the # of checkboxes that have been checked in the same column (ie: if 2 of 4 checkboxes have been checked, the sum field would populate with the number 2)

2.) Have a field show the results of the sum of a different field multiplied by a specific value (ie: Sum of "Field A" x 2 = "Field B")

Screenshot 2023-05-16 at 12.32.18 PM.jpg

Any help would be greatly apreciated!

 

Thank you 🙂

 

 

TOPICS
JavaScript , PDF , PDF forms

Views

3.2K

Translate

Translate

Report

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
2 ACCEPTED SOLUTIONS
Community Expert ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

1. Just give each checkbox an export value of 1 and under 'Calculate' tab select 'Value is the' and pick checkboxes.

 

2. If the number is entered into the field, you can also use the built-in calculation.

View solution in original post

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Simplified field notation doesn't work well with names with dots, spaces...etc give your field a simpler name like "Never" or use this script under 'Custom calculation script':

 

 

var f = Number(this.getField("5.Never").valueAsString);
if(f!=0)
event.value = f*2;
else
event.value = "";

 

 

View solution in original post

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

1. Just give each checkbox an export value of 1 and under 'Calculate' tab select 'Value is the' and pick checkboxes.

 

2. If the number is entered into the field, you can also use the built-in calculation.

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Thanks for this! I have a few questions below, they are bolded:

 

1. Just give each checkbox an export value of 1 and under 'Calculate' tab select 'Value is the' and pick checkboxes.

  • How do I assign an export value to the checkboxes?

 

2. If the number is entered into the field, you can also use the built-in calculation.

  • Ideally Field B should autopopulate with the info from Field A multiplied by whatever number is present next to the "x" (see underlined area in image). Is this possible?

 

 

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

1. Go to checkbox properties and under 'Options' tab you can change export value.

2. Is number next to x also inside field or plain text?

 

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

1. ) Is this correct? See image. 

Martin_Shook_ComDesigner_0-1684257317684.png

 

2. The number next to x is a part of the underlying design layout (generated in InDesign). It won't be editable.

 

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

1. Correct.

2. In that case under 'Calculate' tab select 'Simplified field notation' and input that field name multiply by number.

Example: if Field B name is actual "Field B" rename it so it doesn't include space "FieldB" and let's say number is 2, write this in simplified field notation: FieldB*2 

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

1.) I tried what you oulined. Do you know why the sum in the field below is reading as 10 and not 4?

 

Martin_Shook_ComDesigner_0-1684259673786.png

 

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Whoops, sorry that was the wrong screenshot. Here is the correct one:

Martin_Shook_ComDesigner_0-1684259727085.png

 

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

I can't tell you for sure until I see your file.

Did you give correct export values and 'pick' correct fields?

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Ah! Now I see what I was doing wrong with the checkboxes. I have got that to work!

 

However, now I can't seem to get the highlighted field "6.Never" (in blue) to populate with x2 of the value that will appear in the field above entitled "5.Never" (which currently populates with however many of the checkmarks are selected). Does it look like I've got the calculation right? I've included a screenshot below.

 

Thank you again for all your expertise here!

 

Martin_Shook_ComDesigner_0-1684261325379.png

 

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Simplified field notation doesn't work well with names with dots, spaces...etc give your field a simpler name like "Never" or use this script under 'Custom calculation script':

 

 

var f = Number(this.getField("5.Never").valueAsString);
if(f!=0)
event.value = f*2;
else
event.value = "";

 

 

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

Good to know!

 

That custom calculation worked like a charm! Thanks again for all your help. I have what I need to get this working the way I want it to. 🙂

Votes

Translate

Translate

Report

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
Explorer ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

One more question for you!

 

For the fields where I've added the custom calculation you provided, ie:

 

var f = Number(this.getField("5.Never").valueAsString);
if(f!=0)
event.value = f*2;
else
event.value = "";

 

...is there a way for the fields in this row to have a default visible value of 0 (see highlighted in pink row which currently appear as blank)?

 

Screenshot 2023-05-16 at 3.50.59 PM.jpg

 

Alternatively, if I wanted no "0" value visible in the below row (highlighted in blue) and instead for these fields to be blank... is there a way to accomplish that?

 

Screenshot 2023-05-16 at 3.59.09 PM.jpg

 

 

 

 

Votes

Translate

Translate

Report

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 ,
May 16, 2023 May 16, 2023

Copy link to clipboard

Copied

LATEST

In script change "" to 0 like this:

event.value = 0;

Votes

Translate

Translate

Report

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