Welcome to the LimeSurvey Community Forum

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

Question texts dependent on existence of previous question

  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 8 months ago #218677 by xueting
Hi all,
I was wondering is it possible that question texts dependent on existence of previous question instead of previous answer? Thanks for any help!

In my case, there is a question where texts start with "You reported the following trip for ...(trip purpose)", and here the trip purpose should depend on the existence of previous question (type is text display). For instance, if the question of text display "Work" exist, then here the trip purpose should be "work". The same as other purposes.

By the way, I tried to use if conditional statement depending on the Relevance equation of those text display questions, but failed.
 
The lss. file is attached. 

File Attachment:

File Name: limesurvey...9248.lss
File Size:22 KB


My version:  3.27.9

Kind regards,
Xueting
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 8 months ago #218682 by holch
What do you mean with the question "exists"? A question exists if it was created. Or do you mean if a specific question was shown to the respondent? In this case it probably depends ona a relevance equation and you can use this very same relevance equation to check if the question was shown or not.

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.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 8 months ago #218683 by holch
I had a quick look at your survey and you are missing the { and } around your equations.

But you did not export the question before this process, so all the equations won't work because "workhour" does not exist .

But in general, I feel that you approach is strange. What are the text display questions for? Why do you need them? They look completely obsolete to me, based on what you describe and what I can see in your survey.

So please, show the previous questions "WorkHour", "GroceryFreq" and "NogroFreq" as well, because without them, this example does not make any sense or works.

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.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 8 months ago #218698 by xueting
Thank you holch for your prompt reply!

Yes you are right, "exists" means it was shown, sorry for the unclear expression.

The updated lss. file is attached, with the needed previous questions. And I don't know where to put the missing { and } around the equations, could you specify a bit please? 

File Attachment:

File Name: limesurvey... (1).lss
File Size:37 KB


By the way, I understand my approach looks strange and unusual, let me try to explain. In general, the reason for using the unusual approach, is that I'd like to keep the number of questions as small as possible since random techniques were used in the following part.

Firstly there are questions about the daily travel routines and trips,  the routine questions are "WorkHour", "GroceryFreq", "NongroFreq" and "LSTFreq", corresponding to 4 types of activities: 1) work, 2) grocery, 3) non-grocery shopping, 4) leisure/social visits/touring (the last one type actually consists of 3 sub-categories). For each of the routine question asking the frequency, there is the option of "never", which means do not work / grocery / non-grocery shopping / do leisure activities or social visits or touring. 

Secondly, respondent will be asked to report (max.) 4 trips with different purposes. If they do all the activity types, they will report for 4 different purposes. The thing is the last type (leisure/social visits/touring) consists of 3 sub-categories, in order to collect as much data as possible, it's decided that once someone says they do not do any of the first three activity types (work / grocery / non-grocery shopping), at the same time they do the last activity type (leisure activities/social visits/touring), they have to report more than one trip of this last type. For instance, person A do not work, A should report 2 trips of leisure/social visits/touring if possible plus trips of grocery and non-grocery shopping.  The approach here seems a bit unusual, which is to have trip1, 2, 3, 4 with text display questions controlling the trip purposes, instead of trips specifically for different types (actually 3+3=6 types in total). The reason for using this unusual approach, is that random techniques were used in the following questions about the trips, which was explained in the following section.

Finally, there will be questions about their reported trips, with the opening words "You reported the following trip for ...(trip purpose)". Here the plan is that only 1 of the (max.) 4 reported trips will be shown, so random techniques were used, which is why I'd like to control the number of previous reported trips (max. 4) using the text display questions. Since if there are specific trips for different purposes, many different random groups should be constructed. For instance, let's say 123456 stand for 6 trips for different purposes, the random groups can be 1)  in the condition that the frequency of purpose 1 is chosen "never"; 2)  in the condition that the frequency of purpose 2 is chosen "never"; 3) in the condition that the frequency of purpose 1 and 2 is chosen "never", and so on and so forth. I think the number of conditions should be 2*2*2*2*2*2=64. But using this stange approach, the items in the random group can kind of fixed, always the trips 1,2,3 and 4.

I hope I've made it clear. 
Thanks again for your answering.
Xueting
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 8 months ago #218699 by holch
Wow, you lost me somewhere in this huge text, hahahaha. I will have to read it with a little bit more time.

But what I can tell you already, whenever you use an equation, except in relevance equations (I think the GUI already shows that the {} are not necessary), you need to start the equation with "{" and end it with "}" for Limesurvey to know when the equation starts and when it ends.

E.g. if you want to display something via an equation in a question text, e.g. pipe an answer from a previous question into a question text, you need to use { and }, because otherwise Limesurvey won't know what it is and interpret it as text, which is what happened in your survey. Because in Question text, you can use normal text and equations, the same for equation type questions, you can use normal text and equations. So LS needs to know when you start an equation, otherwise it will just consider it normal text.

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

The following user(s) said Thank You: xueting
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 8 months ago #218701 by holch
For example, if you have a question called "gender" and in the next question you want to show if the person is male or female, if you just put this into the question text or the next question nothing will happen:
Code:
You told us that you are gender
.

It will just write "You told us that you are gender". That is not what you want, I guess.

If you use the following code, Limesurvey will consider "gender" as part of the equation and will understand what to do with it:
Code:
You told us that you are {gender}
.

So limesurvey will understand that you want to display the answer to the question regarding the gender and it would then show something like this "You told us that you are male" or "You told us that you are female", depending on what they answer codes were that you chose.

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

The following user(s) said Thank You: xueting
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 8 months ago #218706 by xueting
Thanks a lot holch for your patience, I finally understand that what I missed was {}, I thought the point was "and" from you mentioned { and }.
And I realized that this is a very basic issue, and was a mistake that I shouldn't have made. I regret not checking it more carefully.
Thank you again for taking our of your time on my issue. Have a nice day,
Xueting
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 8 months ago #218717 by holch
Don't worry, it might be basic, but in German we have a saying: "Sometimes you don't see the forest, because of all the trees."

;-)

These things happen and often are the most difficult ones to solve, because we as the helpers sometimes don't think that this could be the problem, because we find it so basic.

But good that it worked out! Good luck with your study.

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.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 8 months ago #218759 by xueting
I truly appreciate your understanding, that's very nice of you!

Best wishes,
Xueting
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose