Copy link to clipboard
Copied
good morning, I'm looking for help to count the text "SI" which is repeated in many modules. modules call "operations1", "operations2"...etc
Thank you
Copy link to clipboard
Copied
As 'Custom calculation script' of field where you want to show number of "SI" use this:
var total = 0;
for( var i=1; i<=11; i++){
if(this.getField("operations"+i).valueAsString == "SI")
total++;}
event.value = total;
Copy link to clipboard
Copied
@Frell29189474k2dv can you tell us which Adobe application you're using so we can move the thread to the correct forum
Copy link to clipboard
Copied
ACROBAT
Copy link to clipboard
Copied
Thanks, I'll move the thread for you
Copy link to clipboard
Copied
Thanks
Copy link to clipboard
Copied
"operations1", "operations2"...etc are text fields?
How many fields are there?
Is "SI" the only word that will be in those fields?
Copy link to clipboard
Copied
Thanks
Copy link to clipboard
Copied
As 'Custom calculation script' of field where you want to show number of "SI" use this:
var total = 0;
for( var i=1; i<=11; i++){
if(this.getField("operations"+i).valueAsString == "SI")
total++;}
event.value = total;
Copy link to clipboard
Copied
it doesn't work, why? I copied and pasted the code
Copy link to clipboard
Copied
var total= "";
for( var i=1; i<=11; i++);
if(this.getField("OPERAZIONI1").valueAsString=="SI")total++;
event.value = total;it doesn't work, why? I copied and pasted the code
it works with this code
By @Frell29189474k2dv
Copy link to clipboard
Copied
It doesn't work because your field name is not "operations" like you said. In other script, you use "OPERAZIONI1"
To make it work for all field, change it to "OPERAZIONI"+i
If you can't make it work, post your file here.
Copy link to clipboard
Copied
my mistake, it works great. Thank you