Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Can I Create A Quiz In LimeSurvey?

  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 10 months ago - 8 years 10 months ago #120925 by Mike1985_2
Can I Create A Quiz In LimeSurvey? was created by Mike1985_2
As the title suggests... I need to create a quiz and I would like to use LimeSurvey.

It needs to have about 10 participants (so 10 tokens), it's multiple choice, and results need to be kept secret until the admin reveals at the end of the day the winner of the quiz.

So should I create all the questions and maybe write a hidden question at the end that somehow tallies up all the correct answers? Or is there a proper LimeSurvey solution? I can't be the first person to have wanted to do this here?!

Oh, I'm using 2.05
Last edit: 8 years 10 months ago by Mike1985_2. Reason: State version
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #120931 by tpartner
Replied by tpartner on topic Can I Create A Quiz In LimeSurvey?
You can use Expression Manager to load an Equation type question with the score.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 9 months ago #121132 by Mike1985_2
Replied by Mike1985_2 on topic Can I Create A Quiz In LimeSurvey?
Ok I'm going to need some help with this as the documentation is just confusing me... Maybe because it's just a monday.

I have a question with a code of 'a' and the actual question is 'How many objects are there?'. The three answer options are;

A1 | Five
A2 | Six
A3 | Nine

The correct answer is Five.

So how do I write one of these EM questions that will give the participant 1 point if they get the right answer?

I tried creating a question saying
Code:
if(a == answer373263X2020X37746A1, 1, 0)
but that did nothing! When I tested it out in the browser it just showed a red box around "answer373263X2020X37746A1" saying that it was an undefined variable. A similar thing happens if I try
Code:
if(a == A1, 1, 0)

This code
Code:
if({INSERTANS:373263X2020X37746}=="Five","1","0")
displays "if(Five=="Five","1","0")" in the browser (if Five is selected previously) but I'm not seeing a 1 or a 0 as output. So how do I know if my EM is working?

I'm really confused here. Really appreciate some guidance.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121134 by tpartner
Replied by tpartner on topic Can I Create A Quiz In LimeSurvey?
Try this:
Code:
if(a == 'A1', 1, 0)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 9 months ago #121144 by Mike1985_2
Replied by Mike1985_2 on topic Can I Create A Quiz In LimeSurvey?
I've uploaded a screenshot of the result from that question. I guess I was expecting to see a 1 or 0 in the box or something. How do I know if this is working?.... Other than activating my survey!
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121147 by tpartner
Replied by tpartner on topic Can I Create A Quiz In LimeSurvey?
Did you wrap it in curly braces?

Please refer to the manual - manual.limesurvey.org/Expression_Manager

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 9 months ago #121189 by Mike1985_2
Replied by Mike1985_2 on topic Can I Create A Quiz In LimeSurvey?
Ok, I wrapped it in curly braces but it only works if you use double-quotes around the condition parameter/value! Using single quotes makes the quotes come out in its ISO Latin code and the whole thing doesn't work
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
8 years 9 months ago #121199 by Mazi
Replied by Mazi on topic Can I Create A Quiz In LimeSurvey?
You can always use the survey or question logic file to check for errors.

It may also depend on how you add those expressions/which editor mode you are using.
I always recommend to add such expressions using the source code mode.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 9 months ago #121575 by Mike1985_2
Replied by Mike1985_2 on topic Can I Create A Quiz In LimeSurvey?
So, I need to expand this a bit now.... And I've got stuck/confused again.

I have added in a few more questions to my quiz. I'd like to be able to sum up all the correct answers so I extended my equation code to look like this;
Code:
{ 
$total = 0 
if(b == "B1", $total = $total+1, $total) 
if(c == "C3", $total = $total+1, $total) 
if(d == "D2", $total = $total+1, $total) 
if(e == "E2", $total = $total+1, $total) 
if(f == "F3", $total = $total+1, $total) 
if(g == "G1", $total = $total+1, $total) 
}

It didn't work - It just prints out the code on the webpage. It doesn't perform a calculation. Should I still be using expression manager for this?
The topic has been locked.
More
8 years 9 months ago #121579 by Ben_V
Replied by Ben_V on topic Can I Create A Quiz In LimeSurvey?
Code:
{sum(
if(b == "B1", 1, 0) 
if(c == "C3", 1, 0) 
if(d == "D2", 1, 0) 
if(e == "E2", 1, 0) 
if(f == "F3", 1, 0) 
if(g == "G1", 1, 0) 
)}
;)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
8 years 9 months ago - 8 years 9 months ago #121582 by Mazi
Replied by Mazi on topic Can I Create A Quiz In LimeSurvey?
Thanks, Ben_V.

An easier solution would be to enable the assessment mode at survey settings and when adding answer options to your questions b to g you can assign score "1" to the correct answer (and "0" to the others).
You can then use this expression to sum up the scores:
Code:
{sum(b.valueNAOK, c.valueNAOK,...,g.valueNAOK)}

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Last edit: 8 years 9 months ago by Mazi.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose