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
Community Expert
try67Community ExpertCorrect 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

 

try67
Community Expert
Community Expert
April 7, 2021

How would I enter the 1-5 scale when it comes to each question. Just a drop down list? Would it calculate both the employee's ratings and manager's ratings?


Yes, a drop-down list is probably the best option.

And yes, it will calculate a weighted total of all the ratings.

try67
Community Expert
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.