Skip to main content
Participating Frequently
April 6, 2021
Answered

How to add a rating scale with different weights

  • April 6, 2021
  • 2 replies
  • 7127 views

Hi I am looking on how to add rating scales with different weights to calculate a final score. 

 

I am trying to create fillable PDFs for people to complete performance evaluations on when they can't access our online system. 

 

In this scenario I have 8 questions and the questions have different weights for the final score. 

Question 1-5 and 7 have a 15% weight

Question 6 and 8 have a 5% weight

 

both the employee and manager will give a rating for each question which then gets calculated to an overall score. 

 

This topic has been closed for replies.
Correct answer try67

OK, I see. Then assuming the fields are named Q1 to Q8 you can use this code as the custom calculation script of the total field (formatted as Percentage) to show the result:

 

 

var questionsData = [
	{name: "Q1", rating: 0.15},
	{name: "Q2", rating: 0.15},
	{name: "Q3", rating: 0.15},
	{name: "Q4", rating: 0.15},
	{name: "Q5", rating: 0.15},
	{name: "Q6", rating: 0.05},
	{name: "Q7", rating: 0.15},
	{name: "Q8", rating: 0.05},
]

var total = 0;
for (var i in questionsData) {
	var f = this.getField(questionsData[i].name);
	total+=(Number(f.valueAsString)/5 * questionsData[i].rating);
}
event.value = rating;

Edit: Code fixed thanks to Nesa

 

2 replies

Participating Frequently
April 7, 2021

I should be more specific each question (more of a competency)  has a rating of 1-5 that the employee rates themselves on and then the manager also rates the employee from 1-5. 

try67
try67Correct answer
Community Expert
April 7, 2021

OK, I see. Then assuming the fields are named Q1 to Q8 you can use this code as the custom calculation script of the total field (formatted as Percentage) to show the result:

 

 

var questionsData = [
	{name: "Q1", rating: 0.15},
	{name: "Q2", rating: 0.15},
	{name: "Q3", rating: 0.15},
	{name: "Q4", rating: 0.15},
	{name: "Q5", rating: 0.15},
	{name: "Q6", rating: 0.05},
	{name: "Q7", rating: 0.15},
	{name: "Q8", rating: 0.05},
]

var total = 0;
for (var i in questionsData) {
	var f = this.getField(questionsData[i].name);
	total+=(Number(f.valueAsString)/5 * questionsData[i].rating);
}
event.value = rating;

Edit: Code fixed thanks to Nesa

 

Nesa Nurani
Community Expert
April 7, 2021

Just to add, change Q6 and Q8 to 0.05 and in last line change 'rating' to 'total'.

try67
Community Expert
April 7, 2021

It's possible with a script. What kind of fields are they? Radio-buttons? Text fields? Drop-downs? Something else?

And where are the correct answers stored, if at all?

Participating Frequently
April 7, 2021

I should be more specific each question (more of a competency)  has a rating of 1-5 that the employee rates themselves on and then the manager also rates the employee from 1-5.