Welcome to the LimeSurvey Community Forum

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

Attention check: screen out participants based on a multiple-choice question

  • jacob76
  • jacob76's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 week ago #254828 by jacob76
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition  Version 5.6.7+230222
Own server or LimeSurvey hosting: Own server
Survey theme/template: fruity
==================
Hi everyone,

My multiple-choice question as attention check is named G01Q01 and the choices are coded as SQ001, SQ002, and SQ003, and I want to create a True/False hidden equation question right after the multiple-choice question to screen out the participant who select only one of the three choices or none of them. If they select any two of them or three of them, they should not be screened out. So I can create a quota later and setup the quota 0, if the hidden equation question returns to False. 

I checked some information on the forum and tested various versions in the equation question, but I did not work out (here returns to '1' or '0'). For example,
Code:
{if(countif(that.G01Q01.NAOK == 'SQ001' or that.G01Q01.NAOK == 'SQ002' or that.G01Q01.NAOK == 'SQ003') >= 2, '1', '0')}
 Here results are not correct. 
Code:
{if(countif(G01Q01.NAOK == 'SQ001' or G01Q01.NAOK == 'SQ002' or G01Q01.NAOK == 'SQ003') >= 2, '1', '0')}
 Here shows G01Q01 not defined variable. 
Code:
{{if((countif(that.G01Q01.NAOK == 'SQ001') == 1 or countif(that.G01Q01.NAOK == 'SQ002') == 1 or countif(that.G01Q01.NAOK == 'SQ003') == 1) or countif(that.G01Q01.NAOK == '') == 3, '1', '0')}
  Here results are not correct. 
Code:
{{if((countif(G01Q01.NAOK == 'SQ001') == 1 or countif(G01Q01.NAOK == 'SQ002') == 1 or countif(G01Q01.NAOK == 'SQ003') == 1) or countif(G01Q01.NAOK == '') == 3, '1', '0')}
  Here shows G01Q01 not defined variable. 

Any help is appreciated. Thanks a lot! 
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 1 week ago #254830 by Joffm
Yes, it's always wrong syntax.

The manual shows
countif(matches, arg1, arg2, ... argN)

So it should be like
{if(countif("Y",G01Q01_SQ001,G01Q01_SQ002,G01Q01_SQ003)>1,1,0)}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • jacob76
  • jacob76's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 week ago #254831 by jacob76
It worked out perfectly. Thanks a lot!!!

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose