I have a problem with displaying chosen answers at the end of the survey when quetions were presented randomly - defining pseudocode given in topic
www.limesurvey.org/en/community-services...ssment-at-enad#85002
shows all questions in survey even those which weren't displayed.
I suuppose an approperiate pseudocode for following alghoritm"
for (all questions inqurvey)
check if question was displayed
if(yes) then present (code for displaying answer for that question)
else next
I don't have access to the link (404), but maybe something like that:
For Q1:
Code:
{if(Q1.relevanceStatus,"Your answer to Q1 was "+Q1.shown+"<br />","")}
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
Question 1: {Q01.question}
You selected {Q01.shown}
{if (Q01 == 'A1' , 'This is the correct answer' , 'Sorry you chose the incorrect answer. The correct answer is Skin Cancer capital of the world')}
It works if you want to display answer to all questions in survey, but in my case questions will be shown randomly - so I need to present answers only to questions that were displayed.
So I suppose that Q1.relevanceStatus is resposible for recognizing if question was shown?
I prepared code like this:
{if (P2.relevanceStatus, , P2 == 'A1' , "<br />" +P2.question + "Your answer is "+P2.shown+"Itąs a correct answer" , "<br />" +P2.question + "Your answer is"+P2.shown+"<br />. The correct answer is Miles Brown")}
I need also present correct answer to the question. So in the second part of "if" I would need to put a code for correct answer instead of text (Miles Brown). I have over 100 questions in survey so it would be hard to change part of the text if I change something in answer.
murbaniak wrote: So I suppose that Q1.relevanceStatus is resposible for recognizing if question was shown?
Yes
Code:
{if (P2.relevanceStatus AND P2 == 'A1' , "<br />" +P2.question + "Your answer is "+P2.shown+"Itąs a correct answer", "")}
{if (P2.relevanceStatus AND P2 != 'A1' , "<br />" +P2.question + "Your answer is"+P2.shown+"<br />. The correct answer is Miles Brown", "")}
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
Only problem left is that inside group I have randomization (done by javascript) - so for example I show 5 questions form a group of 40. put in fact LimeSurvey sees all questions in group as shown so code you poposed shows all answers.
Questions in survey are all radio type, non obligatory. So I think it can be done by implementing alghoritm: (if answer= "no answer" then dont show information about user answer at the end).
"no answer" option is default and doesn't have an answer code - I have no clue how to get it.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
{if (G1Q00001.relevanceStatus AND G1Q00001== 'A3' , "" +G1Q00001.question + "Your answer is "+G1Q00001.shown+" Your answer is correct!", "")}
{if (G1Q00001.relevanceStatus AND G1Q00001 != 'A3' AND G1Q00001 != "", "" +G1Q00001.question + "Your answer is "+G1Q00001.shown+" Correct answer is Miles Brown. ", "")}