Welcome to the LimeSurvey Community Forum

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

Display subquestion group for each previous answer

  • tw2023
  • tw2023's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago - 1 year 9 months ago #242040 by tw2023
LimeSurvey Cloud
Version 5.6.13

Hello!

I think I need to create a loop, but I don't know how:

I would like to create a survey where respondents can first select a medical condition: either PSSD, PFS or PGAD.

On a new page/in the second group, the symptoms will be queried. Over 60 symptoms are selectable, and respondents can also enter their own symptoms as free text.

For each of the selected/entered symptoms, I would like to ask the same sub-questions.

It should look like this (pseudo-code):

You have selected that you suffer from [answer[0]].
Since when have you been suffering from [answer[0]]?

Has [answer[0]] ever improved?

If 2 is answered with Yes:
3)
What do you attribute to [answer[0]] improving?

Otherwise:
4)
What do you attribute to [answer[0]] never improving?

I would like to do the same for each of the selected symptoms.
Is this possible? It would become a monster of a survey, so I hope I can use logic to avoid having to enter everything manually.

Thank you for your help!

Here is my current approach:
Code:
$count = count(G03Q03) {for (i, 1, $count)} Q3_SQ00{i}: "Has {G03_Q03{i}} ever improved?" {/for}
 
I am not sure what my mistake is here or if I am even using the correct approach:



 
Last edit: 1 year 9 months ago by tw2023.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
1 year 9 months ago #242046 by DenisChenu

Here is my current approach:
Code:
$count = count(G03Q03) {for (i, 1, $count)} Q3_SQ00{i}: "Has {G03_Q03{i}} ever improved?" {/for}
 
I am not sure what my mistake is here or if I am even using the correct approach:

 
Since you are inventing a language: there is no chance that it will work.
See www.limesurvey.org/manual/Expression_Manager

You need one group by answer, one question : one value in database, not 3.

If you have only 3 answers : create 3 group
If you need to ask an unlimited medical conditions : questionExtraSurvey is done for such situation.
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #242080 by holch
There is no loop feature in Limesurvey.

So you need to create either 1 question group for each potential symptom (cleaner for analysis) or at least as many groups as you expect the maximum of symptoms to be.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #242086 by Joffm
And as I wrote already in the German part:
Please, do not cross post 

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

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose