String logic | XM Community
Solved

String logic

  • 13 November 2018
  • 3 replies
  • 18 views

Hello,
I'd like to use string logic in my survey but I'm not sure how. The most similar thing is piped text, but I want to deal with booleans, not just strings being passed.
For example, say one question is "Do you know how many people live in your house?" with answers "yes", "no", and "I do not live in a house".
I want a future question to either say "How many people live in your house?" or "What is the minimum number of people that you can be certain live in your house?", depending on their previous answer. I can also use display logic to remove this question if they answer "I do not live in a house", but I still don't know how to work with strings.
In a programming language, it'd be as easy as:
s = ((knows_exact_number_people)?"How many people ":"What is the minimum number of people that you can be certain ")+"live in your house?"
But I don't know how to do this in Qualtrics. Is this possible? I could make two separate questions, but that'd be ugly.
Thanks!
icon

Best answer by NiC 14 November 2018, 16:13

View original

3 replies

Userlevel 7
Badge +33
Make first question with options Yes, No and I sont live in House.

On second Question ""How many people live in your house?" " Add display logic so that it is asked if "Yes" is selected in previous question.

Also make this subsequent question as text entry numeric type with range of your desire like 1 to 10.
> @bansalpeeyush29 said:
> Make first question with options Yes, No and I sont live in House.
>
> On second Question ""How many people live in your house?" " Add display logic so that it is asked if "Yes" is selected in previous question.
>
> Also make this subsequent question as text entry numeric type with range of your desire like 1 to 10.

But how would this take care of if they say "no", but I still want to know the minimum number of people they estimate live in their house?
Userlevel 7
Badge +27
Hey @pittss
1. Make the _first question_ "Do you know how many people live in your house?" choice question with answer "yes", "no", and "I do not live in a house".
2. Now make two embedded data say "choiceYes" & "choiceNo" in branch logic with "choiceYes" value as "How many people live in your house?" and "choiceNo" value as "What is the minimum number of people that you can be certain live in your house?"
3. Make another embedded variable name say "Q2" after the block in which the first question is now use branch logic to assign value to "Q2" based on the choice of the_ first question_ as shown in image below!
4. Now pipe in the Q2 in the question for the second question(this question will be in the next block of _first question_ after the branch logic) which will be text entry with numeric type entry where you can set the minimum and maximum.

Leave a Reply