Using comma separated answers from text type question as variables

More
1 month 1 week ago #188638 by mdobb_li
Hi!
I was hoping someone might be able to help me out. I'm trying to set up a question and I would like to use the answers given as variables in the following questions. The answer field is currently one of the text types, I didn't really find anything that would be a better fit in this case.

To give you an example, let's say I have a question that says "Please list all the social media platforms you use regularly", and someone gives an answer "Twitter, Instagram".

Based on that, I would like to have two follow up questions (because there were two answers before), that would be something like:
1. I believe that Twitter makes my life better
2. I believe that Instagram makes my life better

The example might not be perfect but hopefully it shows what I'm trying to achieve - is this possible in any way?

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
1 month 1 week ago #188642 by Joffm
Hi,
you can do this by using some equations to split the string, like
eqP1: {strpos(Q1,",",0)} // Find the first comma
eqS1: {substr(Q1,0,eqP1-1)} // Get the first substring
eqX1: {substr(Q1,eqP1+1)} // Remove the first substring from the original string

then do the same with the remaing string.

This is a bit annoying. Furthermore you have to test if there is a remaing string.
Next problem: You say

one of the text types

Here you are not sure, is the respondent separates by comma or by linefeed.

So, in my opinion this is the worst thing to ask the question. (Respondents never answer the way you thought they should)

Why not use a question of type "multiple short question" that displays the rows "dynamic".

Here for demonstration reasons on one page:

At the start:




Entered first platform




Entered more



Joffm


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

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #188647 by tpartner
I agree that you cannot assume that respondents will nicely separate the answers with commas and nothing else like spaces or other characters. It is something I struggle with, even with admins placing values in question settings.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #188669 by holch
I agree, multiple short text is probably the best and cleanest way, for both, analysis and the responder as well. If it would be just a collection of platforms with out any further questions, you could do it in a normal text question and then code the open ended question afterwords, but as you want to use these answers later in the questionnaire, you need to give it more structure.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #188695 by mdobb_li
Hi all!
Thank you very much for your input! I agree with you that using multiple short text is definitely better in my situation. I have a few follow up questions, I would appreciate if you could have a look:
1. Where do I change the row display to 'dynamic'? I've been going through the advanced options for multiple short text and I didn't find it there. I also went through the manual for multiple short text, I was looking for the keyword 'dynamic' but also didn't really anything like that - did I miss it?
2. How do I actually use the answers as variables for next questions? I think it has something to do with relevance equation right? I've been trying to understand the Expression Manager ( manual.limesurvey.org/Expression_Manager ) but it's not that obvious for me and I would really appreciate if you could show me based on the example. Unless there is an actual manual on how to do this? I couldn't find one.

Thanks in advance for your help!

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #188701 by tpartner
1) I think you are referring to random rows - manual.limesurvey.org/Question_type_-_Mu...r_.28random_order.29

2) If, for example, your question code is Q1 and sub-question codes are SQ001, SQ002..., you would access the SQ001 answer with {Q1_SQ001}, SQ002 would be {Q1_SQ002}, and so on.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #188704 by Joffm
1. You display the next subquestion only if the previous is not empty.
Exactly this you enter into the subquestion relevance


2. In Q2 you display the subquestions analogue only if the subquestion in Q1 is not empty


3. Pipe the text by {Q1_SQ001}
I believe that {Q1_SQ001} makes my life better
You may use some html and css to improve the look like
I believe that <span style="color:maroon;font-style:italic;font-weight:bold;background:green">"{Q1_SQ001}"</span> makes my life better
resulting in

Just play around.

Joffm


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

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago #188762 by mdobb_li
Joffm and Tony,
Thanks a lot for your replies. You clarified things for me a lot.
I have one more follow up question, hopefully you don't mind:
Joffm - your relevance equation is !is_empty(Q1_SQ001) - I'm guessing that's when your question ID is 1. I was testing it for my own case and I can't seem to get it to work. My QID is 169, so I did '!is_empty(Q169_SQ001) - that didn't work, when I went to Check logic and it says that my question has errors:



On the side bar it says Q-24, so I thought it might work if I do !is_empty(Q24_SQ001) instead, and I tried that, getting the same error.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago - 1 month 5 days ago #188763 by tpartner
Q1 is the question code, not question ID. So, in your case:

!is_empty(ListTools_SQ001)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 month 5 days ago by tpartner.

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #188832 by mdobb_li
Hi Tony!
Thanks a lot for the explanation, it makes sense, and it works just fine.

If it's not too much trouble, could I ask one more question? I am struggling with one more thing and maybe you will know if there is a solution.

I have a multiple choice question, where the user can select more than one answer. Let's say the answers are A,B,C,D,E,F,G. Now for each one of the answers I have additional questions, that are being asked.
With the help you gave me before I know how to set it up that the additional questions only appear when the answer in the initial question is selected. So if the user selects answers A,C, D and F, he gets four additional questions, but when the user selects only answer A, then he only gets one additional question.

What I would like to do, however, is to limit the amount of additional questions to three. So if the user selects one, two or three answers in the initial question, he gets three more questions, but when the user selects more than three answers, he also gets three questions, that are randomised from the given answers. So if the user selects answers A,B,C,D,E, he gets three questions that are chosen randomly, so could be any combination of them.

I'm not sure if my explanation is clear and makes sense so I will try to rephrase and show it in steps:
1. User answers a multiple choice question, and can select between 1-7 answers.
2. If the user chooses 3 or less answers, he gets specific follow up questions based on these.
3. If the user chooses more than 3 answers, he still gets 3 follow up questions, and it's random which three he will get, obviously out of the answers he selected.

Please let me know if something like this is possible, and if yes, how to tackle it. I would really appreciate your comments.

Please Log in or Create an account to join the conversation.

More
1 month 1 day ago - 1 month 1 day ago #188843 by tpartner
Yes, It is possible. I am travelling this week so cannot give a comprehensive example but you should be able to place the follow-up questions in separate randomized groups and augment your relevance equations with a check on the relevanceStatus of other follow-up questions.

Something similar to this example - www.limesurvey.org/forum/can-i-do-this-w...-of-questions#104067 .

So, maybe something like this for the first follow-up group:

!is_empty(ListTools_SQ001) AND sum(followUp2.relevanceSatus, followUp3.relevanceSatus, followUp4.relevanceSatus, followUp5.relevanceSatus, followUp6.relevanceSatus, followUp7.relevanceSatus) < 3

- manual.limesurvey.org/Expression_Manager#Access_to_Variables

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 month 1 day ago by tpartner.

Please Log in or Create an account to join the conversation.

More
4 weeks 1 day ago #188978 by mdobb_li
Hi Tony,
Thanks again for the hints. I tried to follow it but it's just not working for me. I downloaded the survey posted in the other topic, where Denis showed the way to pick two out of four questions randomly. I followed it exactly, but I am getting errors that I just don't understand.
In his survey example Denis has 4 questions, with question codes Q1, Q2, Q3, Q4, and then he uses a following relevance equation:
sum(Q2.relevanceStatus, Q3.relevanceStatus, Q4.relevanceStatus) <= 1

I tried to do the same thing, I have questions with the codes fbAction, gmAction, nfAction and sfAction, and I use this relevances equation:

sum(fbAction.relevanceStatus, gmAction.relevanceStatus, nfAction.relevanceStatus, sfAction.relevanceStatus) <= 1

I keep getting an error that says "undefined variable" for each part of the equation. I set the randomization group, I even set the fields to optional, to follow the example. The only thing that's different for me is the question type, and I really don't think that causes a problem.

Please Log in or Create an account to join the conversation.

More
4 weeks 1 day ago #188982 by tpartner
What question types are fbAction, gmAction, nfAction and sfAction?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

More
4 weeks 1 day ago #188984 by mdobb_li
They are all arrays - is that a problem?

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!