Welcome, Guest
Username: Password: Remember me

TOPIC: Randomization and Display chosen answers to survey/assessment at enad

Randomization and Display chosen answers to survey/assessment at enad 7 months 3 weeks ago #104708

  • murbaniak
  • murbaniak's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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? :)
The administrator has disabled public write access.

Randomization and Display chosen answers to survey/assessment at enad 7 months 3 weeks ago #104743

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6362
  • Thank you received: 827
  • Karma: 245
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 />","")}
The administrator has disabled public write access.

Randomization and Display chosen answers to survey/assessment at enad 7 months 3 weeks ago #104897

  • murbaniak
  • murbaniak's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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: 7 months 3 weeks ago by murbaniak.
The administrator has disabled public write access.

Randomization and Display chosen answers to survey/assessment at enad 7 months 3 weeks ago #104900

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6362
  • Thank you received: 827
  • Karma: 245
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", "")}
The administrator has disabled public write access.

Randomization and Display chosen answers to survey/assessment at enad 7 months 2 weeks ago #104918

  • murbaniak
  • murbaniak's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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.
The administrator has disabled public write access.

Randomization and Display chosen answers to survey/assessment at enad 7 months 2 weeks ago #104931

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6362
  • Thank you received: 827
  • Karma: 245
No answer : QCODE.NAOK=="" OR is_empty(QCODE)
The administrator has disabled public write access.

Randomization and Display chosen answers to survey/assessment at enad 7 months 2 weeks ago #104960

  • murbaniak
  • murbaniak's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
{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! :)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.214 seconds
Donation Image