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

Javascript for Adobe

New Here ,
Jun 04, 2024 Jun 04, 2024

Hello dear friends,

I have a task to calculate the percentage of fields in Adobe Acrobat PDF form containing status "Done".

There are following statuses:"Done", "Open", "Feedback". So I need to calculate the percentage of the  fields that will be filled with status "Done". The names of fields are "Status1", "Status2", .... "Status15".

I need to write customized Javascript and to be honest I am zero there. Can anyone help me with this ?

TOPICS
Acrobat SDK and JavaScript
273
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

correct answers 1 Correct answer

Community Expert , Jun 04, 2024 Jun 04, 2024

You can use something like this as the field's custom calculation script (set the field's Format to Percentage with the desired number of decimals):

 

var doneCounter = 0;
for (var i=1; i<=15; i++) {
	if (this.getField("Status"+i).valueAsString=="Done")
		doneCounter++;
}
event.value = (doneCounter/15);

 

Translate
Community Expert ,
Jun 04, 2024 Jun 04, 2024

You can use something like this as the field's custom calculation script (set the field's Format to Percentage with the desired number of decimals):

 

var doneCounter = 0;
for (var i=1; i<=15; i++) {
	if (this.getField("Status"+i).valueAsString=="Done")
		doneCounter++;
}
event.value = (doneCounter/15);

 

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
New Here ,
Jun 04, 2024 Jun 04, 2024
LATEST

Thank you a lottttt

It worked! 

 

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