Copy link to clipboard
Copied
I have a document that has multiple checkboxes which, through this forum, I was able to add and get a variety of Totals field.
However, I have 2 columns of 10 checkboxes that need to only total "10" not "20", so, using the tags below, if they selected "RegH 1" only it will cacluate as "1", but if they also select "RegC 1" (on the same row), it too will also calculate as "1". (It's a checklist for "historical" and "current" which both could be selected but need to count as "1" not "2")
Examples of the Tags:
Column 1: RegH 1 Column 2: RegC 1
I don't know Java Script well at all, so any help would be appreciated.
Copy link to clipboard
Copied
If naming of the fields follow this example ("RegH 1"-"RegH 10" and "RegC 1"- "RegC 10")
you can use this as custom calculation script of text field where you want to show total:
var total = 0;
for( var i=1; i<=10; i++){
if(this.getField("RegH "+i).valueAsString != "Off" || this.getField("RegC "+i).valueAsString != "Off")
total++;}
event.value = total;
Copy link to clipboard
Copied
Thanks for the quick response. Greatly appreciated.
It's a bit more complicated. The document has 100+ eheckboxes and only a few are for this calculation. Here are the Tags for each of the 10 rows:
RegH 21 + RegC 12
RegH 22 + RegC 13
RegH 23 + Reg C 14
then...
RelH 2 + RelC 1
RelH 3 + RelC 2
RelH 4 + RelC 3
RelH 5 + RelC 4
RelH 6 + RelC 5
RelH 7 + RelC 6
RelH 8 + RelC 7
Gulp!
Copy link to clipboard
Copied
In that case you can use this:
var c1 = ["RegH 21","RegH 22","RegH 23","RelH 2","RelH 3","RelH 4","RelH 5","RelH 6","RelH 7","RelH 8"];
var c2 = ["RegC 12","RegC 13","RegC 14","RelC 1","RelC 2","RelC 3","RelC 4","RelC 5","RelC 6","RelC 7"];
var total = 0;
for( var i in c1){
if(this.getField(c1[i]).valueAsString != "Off" || this.getField(c2[i]).valueAsString != "Off")
total++;}
event.value = total;
Copy link to clipboard
Copied
OMG...thank you sooooo very much. None of what you sent makes any sense to me but it works perfectly!!! Know you made someone EXTREMELY happy today. Thank you again Nesa 🙂
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more