Skip to main content
Participant
August 16, 2024
Question

JavaScript help - Value of text out of 60 represents 50% of final score

  • August 16, 2024
  • 1 reply
  • 449 views

Hello I am trying to update a document with a Javascript in which, you can calculate the following:

 

Box 1) "Total score out of 60" give a value of 50% of "final score"

Box 2) "total score out of 15" give a value of 50% of "final score"

 

Final score = Box 1+ Box 2 - I can do the simple additions ... don't need help here.

 

 

This topic has been closed for replies.

1 reply

PDF Automation Station
Community Expert
Community Expert
August 16, 2024

Enter the following custom calculation script in the result field:

event.value = this.getField("Box1").value/60 * 37.5 + this.getField("Box2").value/15 * 37.5;

Change Box1 and Box2 to the actual field names.

lovelyHRAuthor
Participant
August 16, 2024

it didn't work.

 

"Total_Comp" is score out of 60

"Total_Goals" is a score out of 15

 

I need 2 scripts ("fifty_comp" & "fifty_goals") to calculate each value as a score out 50

then I will add other box to combine sum of "fifty_comp" & "fifty_goals". - no need for help on this one. 

PDF Automation Station
Community Expert
Community Expert
August 16, 2024

Change both 37.5's to 50, and split the script into 2 parts where the + sign is.  I don't know the names of your fields.  The first script would be:

event.value = this.getField("Box1").value/60 * 50;

the 2nd script would be

event.value = this.getField("Box2").value/15 * 50;