Need help on survey tabulation

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

07-04-2018

I have designed a 5 question survey that has multiple subparts to each question. The use checks a Yes or No Check box for each subpart and i have built if/then statements that yield, for each question, a text outcome (Outcome 1 or Outcome 2).

I want to create an overall scoring for the survey. I was thinking of assigning a value of 10 to each Outcome 1 and -10 to Outcome 2. Then i would tally the numeric scores of all five questions. If the total score >0, then combined answer to the five questions will be Outcome 1. if the score is <0, then the result would be Outcome 2.

The checkbox javascript already is functional, producing the right outcomes for each individual question. i am not sure how best to assign a numerical value to the outcome field to add the five scores together. All fields are in a table.

I thought about using a hidden numerical field (score) to capture a value based on Outcome 1 or Outcome 2

Screenshot 2018-04-07 18.56.09.jpg

In this code, "subrecipient" is outcome 1 and subcontractor is outcome 2.

A relative rookie at javascript and I am not married to this approach and was hoping the better minds of this forum could provide advice on the immediate issue and then on how to add the five question score fields (although i think i can add table fields in formcalc - suggestions/code examples appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

MinusZero

Avatar

MinusZero

MinusZero

09-04-2018

There was a number of errors in the Score1 calculate event

1461896_pastedImage_3.png

  • If should be if
  • .raw.value should be .rawValue
  • elsebif should be else if
  • Score should be Score1

This works now after these changes. This circled button is for checking the code. It can be handy to find which line errors are on. Also pressing CTRL+J after previewing the file will show any javascript errors and what line they are on as well.

1461897_pastedImage_4.png

Javascript Debugger - the highlighted number is the line number in the event code.

1461898_pastedImage_5.png

Answers (4)

Answers (4)

Avatar

Avatar

MinusZero

Avatar

MinusZero

MinusZero

15-04-2018

Hi,

I wouldnt worry about it, everyone has made mistakes and wondered how they did that. The thing I found in my experience is that I never seem to do it again, and it is first thing in my mind when error checking the next time.

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

14-04-2018

Embarrassed by those kind of mistakes.

Thanks for your assistance; now marked as answered.

Avatar

Avatar

lateniteNC

Avatar

lateniteNC

lateniteNC

09-04-2018

Thanks for the replay.

The hidden numeric field is Score 1 in Row 11 in the table1. The field at present is not hidden for testing purposes. I tried to take your suggestion but the code is not working. Any chance you can figure out what is wrong?

The file is attached.

Dropbox - Subcontractor Determination Checklist2.pdf

Thanks.

Avatar

Avatar

MinusZero

Avatar

MinusZero

MinusZero

08-04-2018

I have used hidden fields before for calculations, global variables dont always work how i want.

You would just need to do something like (javascript) - numericField1.rawValue = numericField1.rawValue +10;

Or something like that. To keep a running total, you add (or subtract) the current field total to the 10 points.