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")
Any help would be greatly apreciated!
Thank you 🙂
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.
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 = "";
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.
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.
2. If the number is entered into the field, you can also use the built-in calculation.
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?
Copy link to clipboard
Copied
1. ) Is this correct? See image.
2. The number next to x is a part of the underlying design layout (generated in InDesign). It won't be editable.
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
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?
Copy link to clipboard
Copied
Whoops, sorry that was the wrong screenshot. Here is the correct one:
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?
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!
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 = "";
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. 🙂
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)?
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?
Copy link to clipboard
Copied
In script change "" to 0 like this:
event.value = 0;