Expand my Community achievements bar.

SOLVED

Javascript Division Calculations

Avatar

Level 1

I have sucessfully added the values of 6 radio button groups in my form (using script below )and I now want to divide by 6 to get the average before the result shows in the field. Can someone tell me what to add to the script to do this? I'm a novice at Javascript and depend on this forum to help me out which I want to say thank you for. This forum has seen me through a lot of job tasks requested of me.

 

parseInt(Strategic.Strategic1.rawValue)

 

+ parseInt(BusKnowledge.Knowledge.rawValue)

 

+ parseInt(Compliance.Compliance1.rawValue)

 

+ parseInt(Decision.Decision1.rawValue)

+ parseInt(Demeanor.Demeanor1.rawValue)

 

+ parseInt(Relationships.Relationships1.rawValue);

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

FormCalc comes with an average function you can use.

Just put this script in the calculate event of the field to display the average:

Avg(Strategic.Strategic1.rawValue, BusKnowledge.Knowledge.rawValue, Compliance.Compliance1.rawValue, Decision.Decision1.rawValue, Demeanor.Demeanor1.rawValue, Relationships.Relationships1.rawValue)

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

FormCalc comes with an average function you can use.

Just put this script in the calculate event of the field to display the average:

Avg(Strategic.Strategic1.rawValue, BusKnowledge.Knowledge.rawValue, Compliance.Compliance1.rawValue, Decision.Decision1.rawValue, Demeanor.Demeanor1.rawValue, Relationships.Relationships1.rawValue)

Avatar

Level 1

This worked perfectly. Thank you so much. I've not used FormCalc before, but I'm going to go out and look for tutorial and learning opportunities today.

Again thank you so much for helping us novices out here get through some stressful situations.