Welcome to the LimeSurvey Community Forum

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

Possible to pre-populate array questions?

  • PaulMRFGR
  • PaulMRFGR's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #183622 by PaulMRFGR
Is it possible to pre-populate array options in the following scenario:

Q1. Describe each person in your household and their relation to you
a. Person 1:
b. Person 2:
c. Person 3:
d. Person 4:

Q2. What is the age of each person?
a. [Will show Q1 = a]
b. [Will show Q1 = b]
etc

I'm aware that you can do the above in one big array question, but this won't work for the purposes of our survey.

So is it possible to use their answers from Q1 to change the Y-axis names in Q2?

Thank you.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #183624 by tpartner
Replied by tpartner on topic Possible to pre-populate array questions?
What are the question types? Can you attach a small sample survey (.lss file) containing only the relevant questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • PaulMRFGR
  • PaulMRFGR's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #183625 by PaulMRFGR
Replied by PaulMRFGR on topic Possible to pre-populate array questions?
Hi Toby,

Please see the questions attached:

Question 1:


Question 2 (Person 1, Person 2, etc in the Y-Axis should change depending on what name they gave that person in Q1)


Thank you, hope this helps.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #183626 by holch
Replied by holch on topic Possible to pre-populate array questions?
What Tony wants are not screenshots, but a LSS file that only contains the two questions that are relevant for this issue.

Recreating your questions takes considerable time, so help the helpers to help you and provide a LSS file, so they don't have to spend unnecessary time on recreating your setup in order to be able to help you.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #183627 by Joffm
Replied by Joffm on topic Possible to pre-populate array questions?
Use Expression Manager
{Q1_SQ001}
...


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • PaulMRFGR
  • PaulMRFGR's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #183629 by PaulMRFGR
Replied by PaulMRFGR on topic Possible to pre-populate array questions?
Hi there,

Please find the LSS file attached.

Thank you.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #183630 by tpartner
Replied by tpartner on topic Possible to pre-populate array questions?
Yes, as Joffm suggests, but as you are using an array-texts type, something like this:

Code:
{Q1_SQ001_X001}
Code:
{Q1_SQ002_X001}
Code:
{Q1_SQ003_X001}
Code:
{Q1_SQ004_X001}
...

Sample survey attached:

File Attachment:

File Name: limesurvey...8411.lss
File Size:33 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 6 months ago by tpartner.
The topic has been locked.
  • PaulMRFGR
  • PaulMRFGR's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #183655 by PaulMRFGR
Replied by PaulMRFGR on topic Possible to pre-populate array questions?
Hi Tony,

This is great, thank you so much for helping with this. Quick additional question, but is there anyway we can make the question mandatory but not require people to fill in all rows? For example, if they only have two people in their household (e.g. them + their wife), the next question still shows all subsequent rows allowing for 10 people - which the survey requires them to fill?

Thank you.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #183663 by Joffm
Replied by Joffm on topic Possible to pre-populate array questions?
Well,
you can (or not) show the rows dynamically.

Enter in the subquestion relevance of
person 2 "!is_empty(Q1_SQ001)"
person 3 "!is_empty(Q1_SQ002)"
So only one empty row is displayed if the row before was filled.

The same in question "trips"
Show only rows where are data in Q1.
person 1 "!is_empty(Q1_SQ001)"
person 2 "!is_empty(Q1_SQ002)"


The oldest version I can test in is 2.06. I am not sure if the subquestion relevance is available in 2.05.

See:



Joffm

BTW:
Please overlook the layout of the trips question.
Who is able to read this?
Better to have the explanation separately. And the repeated "number of ... in a typical week" also should be separated as a general hint.

File Attachment:

File Name: limesurvey...8841.lss
File Size:35 KB

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 6 months ago by Joffm.
The topic has been locked.
  • PaulMRFGR
  • PaulMRFGR's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #183668 by PaulMRFGR
Replied by PaulMRFGR on topic Possible to pre-populate array questions?
Hi Joffm,

Thank you - just a quick question (sorry if this is a stupid thing to ask) but where do I actually set subquestion relevance?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #183670 by Joffm
Replied by Joffm on topic Possible to pre-populate array questions?
As I said, I am not sure if it is avauilable in your "stone age" version.

If yes, you find it here:

It's the "R"


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 6 months ago by Joffm.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #183671 by tpartner
Replied by tpartner on topic Possible to pre-populate array questions?
There is no sub-question relevance in 2.05.

A possible solution would be to use separate array questions for each "row" and show/hide them via question relevance.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose