Check out the LimeSurvey source code on GitHub!

Randomization and Display chosen answers to survey/assessment at enad

More
3 years 2 weeks ago #104708 by murbaniak
HI!

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

But i have no clue how to write it.

Help anyone? :)

Please Log in to join the conversation.

More
3 years 2 weeks ago #104743 by DenisChenu
I don't have access to the link (404), but maybe something like that:

For Q1:
{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 service on demand (or search sondages pro).

Please Log in to join the conversation.

More
3 years 1 week ago - 3 years 1 week ago #104897 by murbaniak
In the topic I mentioned earlier the code was:

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.
Last Edit: 3 years 1 week ago by murbaniak.

Please Log in to join the conversation.

More
3 years 1 week ago #104900 by DenisChenu

murbaniak wrote: So I suppose that Q1.relevanceStatus is resposible for recognizing if question was shown?

Yes

{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 service on demand (or search sondages pro).

Please Log in to join the conversation.

More
3 years 1 week ago #104918 by murbaniak
Thank You very much!
It almost works.

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.

Please Log in to join the conversation.

More
3 years 1 week ago #104931 by DenisChenu
No answer : QCODE.NAOK=="" OR is_empty(QCODE)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
3 years 1 week ago #104960 by murbaniak
{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. ", "")}

It works, thanks a lot! :)

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form