Present different values using conditional logic in a piped text | XM Community
Skip to main content
In the questionnaire I am designing, I have the following question:-



> How long is your distance (one-way) for work/school?



The question is presented as a multiple choice question, that accepts a text entry as the first choice and "I do not know" as the second choice.



In a later section of the questionnaire, I would like to use these to compute travel cost. For respondents who provides text entry, I will use the inputted values to compute the cost. For others (respondents who chose "I do not know"), I will be assuming a constant distance to compute travel cost.



Currently, I am using the "Branch logic" to create two separate blocks with the exact same questions. Is there a better way of doing it? Within the same block. Either using something similar to an "if" condition or using "OR" condition.



Thank you in advance.
hey @vishnub87 - Instead of using 2 blocks with branch logic and repeating the same questions again, you could possibly do all this calculation in a single block by:



1. Using Math Operations in the Survey Flow section for calculations - https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/



If you want to display this Travel Score to the Survey taker later on in the Survey, then you would need to have another Block and use Display logic on the questions to display/show the Travel Score based on what option the survey respondent has selected.
> @Igee said:

> hey @vishnub87 - Instead of using 2 blocks with branch logic and repeating the same questions again, you could possibly do all this calculation in a single block by:

>

> 1. Using Math Operations in the Survey Flow section for calculations - https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/

>

> If you want to display this Travel Score to the Survey taker later on in the Survey, then you would need to have another Block and use Display logic on the questions to display/show the Travel Score based on what option the survey respondent has selected.



Hi @Igee



I found a different solution to this. I thought it was important to mention it in the community- it might be beneficial to others.



After the block where information on travel time was collected, I created an embedded variable. I created an embedded variable that takes two values-



value 1- takes the distance based on the text entry

value 2- takes the constant value



To compute the travel cost, I used the "Embedded data" in the "Piped Text" option and used this new embedded variable that I created. This solved the issue for me.

Leave a Reply