0 votes
in Datenauswertung by s101866 (110 points)

Hello,
I want to display a final result on the end of my survey for participants.
Imagine 5 variables GO02_01 to GO02_05. Possible values are 1-5.
I want to sum them up and display the final result on the final page, after all questions have been answered.

Could you pls show me a code and example formula?

I am looking forward to your answer.
Thank you.
Carola

1 Answer

0 votes
by SoSci Survey (327k points)

That's easy :)

$sum = valueSum('GO02');
html('<p>You have '.$sum.' of 25 points.</p>');

For more details, I recommend the manual Personal evaluation for the participant.

by s101866 (110 points)
Hi, could you pls advise here also:
1) I can not integrate PHP Code on the last page. How to?
2) I tried it on another page. Then I got an error message.
Could you find the solution?
$sum = valueSum('E021','E022', 'E032','GO01');
html('<p>Sie haben '.$sum.' von 244 Punkte erreicht.</p>');
Error:
Für die Frage E021 wurde kein Item mit der Kennung 0 gefunden
Sie haben von 50 Punkte erreicht.

THANK YOU.
by SoSci Survey (327k points)
ad 1) not at all - create an additional page before the last one. If you want no further one, user buttonHide().

ad 2) Please us an array for the variables:
valueSum(array('E021','E022', 'E032','GO01'));

Note, that this will only (!) work, if E021 etc. are variables, not questions with multiple Items. If these question have more items, please write:

$sum = valueSum('E021') + valueSum('E022') + ...;

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...