Copy link to clipboard
Copied
I have a form that our employees use to conduct performance evaluations on our various sites. One example would be "site cleanliness," and the options for evaluation in the field would be "compliant", "non-compliant", "repeat non-compliant", "N/A." How would I go about adding up these responses and outputting the total to a field at the bottom. Does this require javascript? I am using Adobe Acrobat Pro DC
Like I said it would be better to see file with all fields, you can try something like this if you use percentage from 75 fields.
var x = Number(this.getField("Total").value);
var xda = Number(this.getField("DeficienciesA").value);
var xdb = Number(this.getField("DeficienciesB").value);
var xdc = Number(this.getField("DeficienciesC").value);
if(x == 0)
event.value = "";
else if(xda == 0)
event.value = 5.0;
else if(xda == 0 && xdb < 22.5 && xdc < 37.5)
event.value = 4.0;
else if(xda < 3 && xdb < 37.5 && x
Copy link to clipboard
Copied
Yes, you need javascript.
Can you describe how you imagine process, one field to show total, total of what choice?
Or separate fields, one for each choice?
Field names? how many fields?
Copy link to clipboard
Copied
People will be selecting choices like "deficient", "compliant", "repeat deficient", "N/A" in the analysis column and I want to add those values up to display in the scoring table at the bottom. Each row also has a value of "A", "B", or "C" assigned to it to show the level of importance of each analysis and I also want to calculate the number of choices sorted by the A B, and C importance. Each of the analysis columns that I want to record scores from are labeled with this convention: "AnalysisA1"(first analysis cell that's valued with "A" importance), "AnalysisA2"(second analysis cell valued at "A" importance), "AnalysisB1" etc.
The most complicated portion for me will be the "Initial Periodic Evaluation Score" Calculation:
5.0 = No deficiencies
4.0 = No A deficiencies, less than 30% B deficiencies, less than 50% C deficiencies
3.0 = Less than 3 A deficiencies, less than 50% B deficiencies, greater than 50% C deficiencies
2.0 = Less than 7 A deficiencies, greater than 50% B deficiencies
1.0 = More than 8 A deficiencies
Copy link to clipboard
Copied
It would be much easier if you could share a file with us to see the actual fields
Copy link to clipboard
Copied
I was trying to earlier but the upload wasnt functioning
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Let me know if you have any other questions regarding what I want to do. Thanks
Copy link to clipboard
Copied
I am thinking I need to create a list of each cell type grouped by A, B, and C and loop through each list and somehow count each response type from the list and get the number of each response type to appear at the proper field. I have no adobe or javascript experience though so I might be wrong.
I wrote out a for loop from some research but I am certain the syntax isnt correct. all of the field names arent inserted in the form either so I just described them in the println
var aFields = this.getField(“A_[*]).value
for (i = 0; i < aFields.length; i++){
if aFields.value == "Deficient"
println("NumberOfDeficienciesA").count
if aFields.value == "Not Applicable
println("NumberOfnaA").count
if aFields.value == "Repeat Deficient"
println("NumberofRepeatDeficient").count
if aFields.value == "Not Evaluated"
println("NumberOfNotEvaluated").count
if aFields.value == "Compliant"
println("NumberOfCompliant").count
}
Copy link to clipboard
Copied
How do you want to show result with multiple ranks (A,B,C) you want to show result in same field for each rank like this: 'deficiencies' A4 B2 C8 ?
Copy link to clipboard
Copied
I would like to calculate the number of deficiencies for A rank, B rank, and C rank and show the result at a grid on page 10 called "Number of Deficiencies." I also need help with calculating the "Initial Periodic Score" on the same page with the following rules
Initial Periodic Score (1-5)
Scoring Criteria
5.0 = No deficiencies4.0 = No A deficiencies, less than 30% B deficiencies, less than 50% C deficiencies3.0 = Less than 3 A deficiencies, less than 50% B deficiencies, greater than 50% C deficiencies2.0 = Less than 7 A deficiencies, greater than 50% B deficiencies1.0 = More than 8 A deficiencies
Copy link to clipboard
Copied
It would be better if you shared whole file.
From what i can see there should be 16-A, 31-B and 28-C fields and lets say fields for result would be called "DeficienciesA","DeficienciesB","DeficienciesC" use this code in 'total' field:
var DA = 0;
var DB = 0;
var DC = 0;
var total = 0;
for ( var i=1; i<=16; i++){
if(this.getField("AnalysisA"+i).valueAsString == "Deficient")DA++;}
for ( var i=1; i<=31; i++){
if(this.getField("AnalysisB"+i).valueAsString == "Deficient")DB++;}
for ( var i=1; i<=28; i++){
if(this.getField("AnalysisC"+i).valueAsString == "Deficient")DC++;}
total = DA+DB+DC;
if(total == 0){
this.getField("DeficienciesA").value = "";
this.getField("DeficienciesB").value = "";
this.getField("DeficienciesC").value = "";
event.value = "";}
else {
this.getField("DeficienciesA").value = DA;
this.getField("DeficienciesB").value = DB;
this.getField("DeficienciesC").value = DC;
event.value = total;}
This will calculate totals of "Deficient" for each field and total of them.
Copy link to clipboard
Copied
Thank you so much, and I am sure I can just change the fields for the N/A fields and repeeat deficient fields. Was there some part of the file that you couldnt see?
Copy link to clipboard
Copied
Do you have an idea of how I would calculate the scoring criteria as follows?
Initial Periodic Score (1-5)
Scoring Criteria
5.0 = No deficiencies4.0 = No A deficiencies, less than 30% B deficiencies, less than 50% C deficiencies3.0 = Less than 3 A deficiencies, less than 50% B deficiencies, greater than 50% C deficiencies2.0 = Less than 7 A deficiencies, greater than 50% B deficiencies1.0 = More than 8 A deficiencies
Copy link to clipboard
Copied
Like I said it would be better to see file with all fields, you can try something like this if you use percentage from 75 fields.
var x = Number(this.getField("Total").value);
var xda = Number(this.getField("DeficienciesA").value);
var xdb = Number(this.getField("DeficienciesB").value);
var xdc = Number(this.getField("DeficienciesC").value);
if(x == 0)
event.value = "";
else if(xda == 0)
event.value = 5.0;
else if(xda == 0 && xdb < 22.5 && xdc < 37.5)
event.value = 4.0;
else if(xda < 3 && xdb < 37.5 && xdc > 37.5)
event.value = 3.0;
else if(xda < 7 && xdb > 37.5)
event.value = 2.0;
else if(xda > 8)
event.value = 1.0;
else event.value = "";
Copy link to clipboard
Copied
Ahh I see all the fields arent in there. sorry about that. Thanks so much for your help
Copy link to clipboard
Copied
I would put that in the final periodic score field once I have all the fields named?