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

ja script count text

Participant ,
Apr 01, 2023 Apr 01, 2023
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

 

1.7K
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 Expert ,
Apr 01, 2023 Apr 01, 2023

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;

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 ,
Apr 01, 2023 Apr 01, 2023

@Frell29189474k2dv can you tell us which Adobe application you're using so we can move the thread to the correct 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
Participant ,
Apr 01, 2023 Apr 01, 2023

ACROBAT

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 ,
Apr 01, 2023 Apr 01, 2023

Thanks, I'll move the thread for you

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
Participant ,
Apr 01, 2023 Apr 01, 2023

Thanks

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 ,
Apr 01, 2023 Apr 01, 2023

"operations1", "operations2"...etc are text fields?

How many fields are there?

Is "SI" the only word that will be in those fields?

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
Participant ,
Apr 01, 2023 Apr 01, 2023
  • "operations1" "operations2" etc...  yes
  • Yes, "SI" is the only result.
  • The fields are 11

Thanks

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 ,
Apr 01, 2023 Apr 01, 2023

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;

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
Participant ,
Apr 01, 2023 Apr 01, 2023
it doesn't work, why? I copied and pasted the code
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
Participant ,
Apr 01, 2023 Apr 01, 2023
quotevar 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

 

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 ,
Apr 01, 2023 Apr 01, 2023

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.

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
Participant ,
Apr 01, 2023 Apr 01, 2023
LATEST

my mistake, it works great. Thank you

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