- Posts: 22
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Different types of text piping in survey
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
5 years 7 months ago #173721
by jfrey1
Different types of text piping in survey was created by jfrey1
Good morning. I know it's possible to pipe text from a response later in a survey using 'Placeholder fields.' But it is possible to pipe things other than the response? Specifically, I'd like to pipe text that I've defined that's different than the option ("Transportation" in the example below) and pipe nothing (the 'option 3' scenario below), all from 1 question. Here's the example (sample survey attached):
Demo question #1 (single select): What services do you use?
Option 1 reads "Service one"
Option 2 reads "Service two"
Option 3 reads "Service three"
If option 1 is chosen, pipe "Service one" later in survey (I'm able to do this with 'Placeholder fields')
If option 2 is chosen, pipe "Transportation" later in survey (Is this possible?)
If option 3 is chosen, pipe no text later in survey (Is this possible?)
Later question in the survey about satisfaction:
If option 1 is chosen, the question text would read "What is your Service one satisfaction?"
If option 2 is chosen, the question text would read "What is your Transportation satisfaction?"
If option 3 is chosen, the question text would read "What is your satisfaction?"
Thanks!
Demo question #1 (single select): What services do you use?
Option 1 reads "Service one"
Option 2 reads "Service two"
Option 3 reads "Service three"
If option 1 is chosen, pipe "Service one" later in survey (I'm able to do this with 'Placeholder fields')
If option 2 is chosen, pipe "Transportation" later in survey (Is this possible?)
If option 3 is chosen, pipe no text later in survey (Is this possible?)
Later question in the survey about satisfaction:
If option 1 is chosen, the question text would read "What is your Service one satisfaction?"
If option 2 is chosen, the question text would read "What is your Transportation satisfaction?"
If option 3 is chosen, the question text would read "What is your satisfaction?"
Thanks!
Attachments:
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
5 years 7 months ago #173725
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Different types of text piping in survey
You have to use the if-statement,like:
{if(Q1==1,"Service1",if(Q1==2,"Transportation",""))}
Read the manual about the if-statement, and especially the example about nested if-statements.
Best regards
Joffm
{if(Q1==1,"Service1",if(Q1==2,"Transportation",""))}
Read the manual about the if-statement, and especially the example about nested if-statements.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
5 years 7 months ago #173743
by jfrey1
Replied by jfrey1 on topic Different types of text piping in survey
I tried to adapt the code above to the survey, but it doesn't seem to work. Am I missing something?
What is your {if(SRV==1,"Service one",if(SRV==2,"Transportation"," "))} satisfaction?
What is your {if(SRV==1,"Service one",if(SRV==2,"Transportation"," "))} satisfaction?
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
5 years 7 months ago #173746
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Different types of text piping in survey
Well, "it doesn't seem to work" is not very helpful.
What exactly happens? Can you export a LSS file of just this specific part of the survey for us to have a look at?
I assume that "SRV" is the code of the question and 1, 2, 3 are the answer option codes?
What exactly happens? Can you export a LSS file of just this specific part of the survey for us to have a look at?
I assume that "SRV" is the code of the question and 1, 2, 3 are the answer option codes?
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.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
5 years 7 months ago #173763
by jfrey1
Replied by jfrey1 on topic Different types of text piping in survey
After some further tinkering, I got most of it to work. For the option that I'd like to pipe no text for (option 3), it's displaying a double space instead of a single space, whether or not I have a space between the double quotes in the code (bold red below):
What is your {if(SRV==1,"Service one",if(SRV==2,"Transportation"," "))} satisfaction?
Screenshot attached.
What is your {if(SRV==1,"Service one",if(SRV==2,"Transportation"," "))} satisfaction?
Screenshot attached.
Attachments:
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
5 years 7 months ago #173776
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Different types of text piping in survey
Because there is a space before { and one after }. Two spaces...
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.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
5 years 7 months ago #173786
by jfrey1
Replied by jfrey1 on topic Different types of text piping in survey
If I remove one of the spaces, then the other options won't pipe correctly:
What is your Service onesatisfaction?
What is yourService one satisfaction?
What is your Service onesatisfaction?
What is yourService one satisfaction?
The topic has been locked.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
5 years 7 months ago #173787
by jfrey1
Replied by jfrey1 on topic Different types of text piping in survey
Never mind, I found a workaround for that (adjusting the spacing around the brackets as well as around the desired piped text). Thanks!
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
5 years 7 months ago - 5 years 7 months ago #173788
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Different types of text piping in survey
Exactly! You can always include a space after the piped texts:
This should do the trick.
Or:
Code:
What is your {if(SRV==1,"Service one ",if(SRV==2,"Transportation ",""))}satisfaction?
Or:
Code:
What is your {if(SRV==1,"Service one satisfaction?",if(SRV==2,"Transportation satisfaction?","statisfaction?"))}
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 5 years 7 months ago by holch.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 7 months ago - 5 years 7 months ago #173804
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Different types of text piping in survey
A,d
I always use it like this … real empty string
edit
I always use it like this … real empty string
Code:
What is your {if(SRV==1,"Service one",if(SRV==2,"Transportation",""))} satisfaction?
edit
Code:
What is your {if(SRV==1,"Service one ",if(SRV==2,"Transportation ",""))}satisfaction?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 7 months ago by DenisChenu. Reason: Bad see : space after and before equation
The topic has been locked.