Welcome to the LimeSurvey Community Forum

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

Get the answer chosen on the previous question on title of the next question

  • zserban
  • zserban's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago #163901 by zserban
Hello,


I am wondering how to deal with this issue:

Q1. (question with multiple answers )From the list below pick ...
1.....
2....
3....
Other

Q2. (question with a single answer, array filter Q1) Which .. .do you use mostly?
1.....
2....
3....
{Q1_other}

Q3. (question with multiple answers) Please choose from the list below the reason for {INSERTANS:...}
...

The problem is I only get the name of 1,2 or 3. If he chooses {Q1_other} it will show just that, Q1_other.

Can I use some IF statement or something in this case? How would you solve this?

Thank you!
The topic has been locked.
More
6 years 2 months ago #163913 by jelo
If you access the answercode, you'll get the answercode.
The answercode is Q1_other, not the text entered by the respondent.

Try Q1_other.shown. Q1_other should be the same as Q1_other.code
This is quite confusing depending on the question type. There is still room for improvement.

To display Q1.shown or Q1_other.shown needs to be done via a if clause.
Code:
{if(Q1.code == 'whatever' OR Q01.code == 'whatever', Q1.shown, Q1_other.shown)}
There are more elegant solutions possible, but a simple approach first cannot be bad.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: zserban
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago - 6 years 2 months ago #163917 by tpartner
Here's another IF statement that should work:

Code:
{if(!is_empty(Q1_other), Q1_other.shown, Q1.shown)}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 2 months ago by tpartner.
The following user(s) said Thank You: zserban
The topic has been locked.
  • zserban
  • zserban's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago - 6 years 2 months ago #163918 by zserban
tpartner, jelo thank you for your inputs. They were really helpful!


What I did was to rename Q2 other code into other(Q2 had no other option in reality, in was only transferring the other from Q1), and input there the value {Q1_other}.

Then the logic I use in the text of the following questions, which address the user picking on Q3 was this:

if(Q3.NAOK == "other", Q1_other, Q3.shown)

Only if I put Q1_other, I get the text value of Q1_other, which was what I needed, no the expression.
Last edit: 6 years 2 months ago by zserban.
The topic has been locked.
  • zserban
  • zserban's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago - 6 years 2 months ago #163919 by zserban
Can I complicate things a little bit? :)

I don't want to ask them Q3 if they only select one item on Q2.

But Q4 also needs to have in the title the name of the answer from Q2.

I know I can make a condition on Q3 to only show if the count of responses is bigger than 1.

But, how do I make the logic to get the name of their picking on Q4 considering the above (taking into account the 2 possible cases, 1) user selected more than 1 answer at Q2 and is asked Q3 from which i get the answer; 2) the user isn't asked Q3, and the answer from Q2 is the name I need)?

p.s. Obviously, the logic I use for Q3 to get the name was 'if(Q2.NAOK == "other," Q1_other, Q2.shown)' (not Q3:D)
Last edit: 6 years 2 months ago by zserban.
The topic has been locked.
  • zserban
  • zserban's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago - 6 years 2 months ago #163920 by zserban
I got this far, or at least that's what I think it might work :)

{if(is_empty(Q3),
if((Q2_other.NAOK == "Y"),
Q1_other,
NO_IDEA_WHAT_TO_PUT_HERE_SINCE_Q1_is_multiple_answer_question),
if(Q2.NAOK == "other",
Q1_other,
Q2.shown)
)
}
Last edit: 6 years 2 months ago by zserban.
The topic has been locked.
  • zserban
  • zserban's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago #163926 by zserban
Hi,

Here is a test survey with my problem, if someone has some time for it. Just in case I'm not very clear, which I know it might be the case.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose