I’m trying to build a survey where each response has a corresponding score.
Say, Q1 has 3 answers. Answer 1 = 1, Answer 2 =, Answer 3 = 2 (yes, same score as Answer 2).
Now after asking say 5 Questions, I want to add up the score and show that score to the Enumerator on field
Can this be done and is there a sample script that I can look at?
This *should* work or at least get you close. You will need to use the “custom script” action.
// BEGIN SCRIPT
%%Q_1_ID_Number = 10; // This is the acctual ID numbers of your questions
%%Q_2_ID_Number = 11;
%%Q_3_ID_Number = 12;
%%Q_4_ID_Number = 15;
%%Q_5_ID_Number = 17;
%%Q_1_Value = gapiGetValue(%%Q_1_ID_Number);
%%Q_2_Value = gapiGetValue(%%Q_2_ID_Number);
%%Q_3_Value = gapiGetValue(%%Q_3_ID_Number);
%%Q_4_Value = gapiGetValue(%%Q_4_ID_Number);
%%Q_5_Value = gapiGetValue(%%Q_5_ID_Number);
%%Q_Sum = %%Q_1_Value + %%Q_2_Value + %%Q_3_Value + %%Q_4_Value + %%Q_5_Value ;
%%output .= “Your sum is: ” . %%Q_Sum . ” out of N.”;