Welcome to the LimeSurvey Community Forum

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

Fill a hidden radio question from array for quota

  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 9 months ago - 6 years 9 months ago #156255 by tixeon
I want to screen out on an array question using quotas (have to use quotas instead of a screen out page with submit button removed as I have to use a screen out URL divert for a panel) but Limesurvey won't let me quota on an array, so I figure I need to do a equation/hidden question work-around?

The question is


S1 How often do you...?

Answer options
1 daily
2 weekly
3 fortnightly
4 monthly
5 less often
6 never

subquesitons
1 option 1
2 option 2
3 option 3
4 option 4

The screen out needs to be those who DONT do option 1 OR option 2 at least weekly

I figure I need to create a hidden radio question with a 'screen out' answer option and then an equation that selects 'screen out' in this radio if (option 1 NOT 1 or 2) AND (option 2 NOT 1 or 2). I am having a lot of trouble working out the equation to do this.
Last edit: 6 years 9 months ago by tixeon. Reason: Upload example lss
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago - 6 years 9 months ago #156282 by tpartner
Given a quota question code "HQwork" and answer code "A1", it seems to me that the assignment equation should be:

Code:
{HQwork = if(S1_SQ001 != 'A1' && S1_SQ001 != 'A2' && S1_SQ002 != 'A1' && S1_SQ002 != 'A2', 'A1', '')}

More on the assignment operator here - manual.limesurvey.org/Expression_Manager..._Assignment_Operator

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 9 months ago by tpartner.
The following user(s) said Thank You: DenisChenu, tixeon
The topic has been locked.
  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 9 months ago #156295 by tixeon
Thank you, unfortunately that doesn't work. Could it be that the version I am using doesn't like ampersands as they are showing up red (see attached)?


I am using Version 2.05+ Build 140502 - I have plans to upgrade but am waiting for a survey to finish being in field as I don't want to risk it while I have live surveys.
The topic has been locked.
  • aofnoy01
  • aofnoy01's Avatar
  • Visitor
  • Visitor
6 years 9 months ago #156361 by aofnoy01
Hello

Thank you for the bad luck that did not work. Is it possible that the version I'm using does not like it?
The topic has been locked.
  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 9 months ago #156363 by tixeon
Its not too late (launching tomorrow) so I would definitely welcome any further thoughts regarding this. I tried changing the & to 'and' and also using " instead of ' but it still won't work.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago #156375 by tpartner
This should work:

Code:
{HQwork = if(S1_SQ001 != 'A1' AND S1_SQ001 != 'A2' AND S1_SQ002 != 'A1' AND S1_SQ002 != 'A2', 'A1', '')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 9 months ago #156408 by tixeon
Thank you. I tried that but it doesn't work for me. Could you please advise what I am doing wrong?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago - 6 years 9 months ago #156446 by tpartner
Two problems...

1) You cannot hide the equation question with the "Always hide this question" setting - in that case it will never be rendered. Hide it with a class "hidden".

2) The equation question is full of garbage HTML. It looks like you pasted directly from the forum into the LimeSurvey editor. Paste first into a plain-text editor like Notepad++ or use the source mode in the LS editor.



Working survey attached:

File Attachment:

File Name: limesurvey...4493.lss
File Size:23 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 9 months ago by tpartner.
The following user(s) said Thank You: tixeon
The topic has been locked.
  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 9 months ago #156520 by tixeon
Thank you.

After much pulling out of hair and yelling at the computer I finally figured it out. I didn't realise that you need to go to the next page for the equation to activate. I was expecting it to change the HQwork answer in real time so thought it wasn't working when I was testing (annoying thing is that the very first equation I came up with actually would have worked had I realised this). In hind sight this is obvious.

Also, my version of Limesurvey doesn't have the CSS class option in the advanced question options (not going to upgrade until there are no surveys in field as it is too risky) so I had to put the CSS in the template for that (#questionXX {display: none;}).

It is all working well now though, HOORAY.

Thanks for everyones help!!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose