Quiz: Show correct order for the question type ranking

More
8 months 2 weeks ago #179954 by mariaa
:) Hi all,

I´ve created a quiz which contains the following ranking task:

a456: Please arrange the specified countries according to their size so that the biggest country is at the top.

A1 Germany
A2 Bosnia and Herzegowina
A3 France
A4 Iceland
A5 Poland


Let´s suggest that A5,A3,A1, A4, A2 is the (only) correct order. After the participant completed the ranking, I´d like to let him know if his answer was correct or wrong.

I found a solution for this in the limesurvey forum - but unfortunately just for multiple choice questions.

if(A1_SQ001.NAOK == "Y" and A1_SQ002.NAOK == "" and A1_SQ003.NAOK == "" and A1_SQ004.NAOK == "Y"), ("You chose this answer correctly.", "You chose this answer incorrectly")

Since I´ve never worked with java script or coding, I don´t know how to adjust this code for my ranking task.

In contrast to the multiple choice question, all answers will be selected in the ranking task but the correct order is important.

It would be incredibly helpful if you could show me the correct code /JavaScript.


Finally I have a very simple question. I´m not completely sure about where to insert the code. When I finally have found the correct code for the ranking task - is it correct that I create a question Type "text display" and insert the code to it´s question field like on the picture attached below?





Thanks a lot for your support!

Kind regards


Maria
Attachments:

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
8 months 2 weeks ago - 8 months 2 weeks ago #179955 by Joffm
Hi, Maria,

Finally I have a very simple question. I´m not completely sure about where to insert the code. When I finally have found the correct code for the ranking task - is it correct that I create a question Type "text display" and insert the code to it´s question field like on the picture attached below?


Yes, You can use it

But to start:
If you just activate your survey with the ranking question you see in the answer table this:


Now you see, that in Q2_1 the code of the first ranked country is stored, in Q2_2 the code of the second ...
This means the correct order ist
Q2_1==5 AND Q2_2==3 AND Q2_3==1 AND Q2_4==4 AND Q2_5==2

Now back to the text display
In the question text you enter:
{if(Q2_1==5 AND Q2_2==3 AND Q2_3==1 AND Q2_4==4 AND Q2_5==2,"You chose this answer correctly.", "You chose this answer incorrectly")}


Very basic example:

File Attachment:

File Name: limesurvey...2-03.lss
File Size:16 KB


Joffm




Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 8 months 2 weeks ago by Joffm.
The following user(s) said Thank You: DenisChenu, mariaa

Please Log in or Create an account to join the conversation.

More
8 months 2 weeks ago #180013 by mariaa
Hi Joffm,

I´m sorry for my late response. Unfortunately I got ill and just found the time to have a look at you solution. Thanks a lot for your detailed answer. Especially the screenshots have been very helpful =) I had to adjust some variable names but now it´s finally working with this code:

{if(a456_1.NAOK=="A3" AND a456_2.NAOK=="A1" AND a456_3.NAOK=="A5" AND a456_4.NAOK=="A4" AND a456_5.NAOK=="A2","You chose this answer correctly.", "You chose this answer incorrectly")}

Do you know if there is any possibility to show the text message"You chose this answer incorrectly" "You chose this answer correctly" only after the participant has answered the question completely? (Best after he already clicked the "next" button.) I know, It would be a possibility to create a new question group and show the text on the next page but I´d prefer to show it on the same page as the question.


If yes, do you know how I have to adjust my code so that it´s working? Many thanks in advance!


Currently the text "You chose this answer incorrectly" is already shown before you even start to answer the question.

Attachments:

Please Log in or Create an account to join the conversation.

More
8 months 2 weeks ago #180043 by Joffm
Of course, you can.

Set the relevance equation of the text display to : count(that.Q2)==5
Q2: Code of ranking question
5: number of ranked items





Best regards
Joffm

I had to adjust some variable names but now it´s finally working with this code:

Therefore it's always advisable to send a small example as *.lss


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The following user(s) said Thank You: DenisChenu, mariaa

Please Log in or Create an account to join the conversation.

More
8 months 1 week ago #180097 by mariaa
Hi Joffm,

once again thanks for your great support. It´s working =) I was able to adapt this solution to most of my question types. Just multiple choice is causing some problems since I don´t know how many answers the participant will mark with a cross.

For example


Q1:Please mark all colours

SQ001: red
SQ002:green
SQ003: yellow
SQ004:sheep
SQ005: snake

The answers SQ001, SQ002 and SQ003 would be correct. But if I set the relevance equation to count(that.Q1)==3 , there might be the chance that a participant who already marked SQ001, SQ002 and SQ003 was originally planning to mark the answer "sheep" with a fourth cross but lets it be because the text " you chose this answer correctly" already poped up. Or other way round: he just marks two answers and doesn´t receive any text message.

Do you know how to show the text message at the same page after the participant klicked at the next button in this case ? Or do you know any other possibility to solve this problem?

I´m sorry for asking you again ;) If you can not think of a quick approach, I have understanding for this and will open a new topic about this.


Kind regards and thank a lot

Maria

Please Log in or Create an account to join the conversation.

More
8 months 1 week ago #180110 by DenisChenu
Why not , for all question (group)

after your quizz : add a checkbox question type with only one choice :
- Validate my answers
and the new question are show only if validate my answers are checked.

Else : show the validation only after move next.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: mariaa

Please Log in or Create an account to join the conversation.

More
8 months 1 week ago #180167 by mariaa
Hi Denis,

Thanks for your quick answer. Sounds like a great idea to sum up all solutions on one page at the end of the survey. But in this case I have one question: On this last page I´d like to show the participants answers, too (so that he rembers his answers) and can directly see his mistakes.

For example:

In question no. 1 you choose the ranking order "Iceland, Poland, France, Germany, Bosnia and Herzegowina".

You chose this answer incorrectly. The correct solution is.....


Do you know how I need to adjust ( or what I need to add to) my syntax so that the participant can additionaly see the answer he made? What would the syntax look like in the end ?


{if(a456_1.NAOK=="A3" AND a456_2.NAOK=="A1" AND a456_3.NAOK=="A5" AND a456_4.NAOK=="A4" AND a456_5.NAOK=="A2","You chose this answer correctly.", "You chose this answer incorrectly")}

Many thanks in advance

Kind regards

Mariaa

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!