I have three questions that ask about respondents' travel distance.
And I want to redirect a respondent at the end of a survey to different URLs, based on the longest distance reported, like:
* If the longest distance among three is less than 5: redirect to "google.com"
* If the longest distance among three is between 5 and 10: redirect to "youtube.com"
* If the longest distance among three is over than 10: redirect to "amazon.com"
So, for example, if a respondent answered 5, 3, 8 miles for each question, I'd like to redirect this respondent to "youtube.com" because the longest one is "8."
Is it possible to do this by using math operations or javascript?
I tried to use Qualtrics' math operation, but it seems that there is no operation for like this: $e{max(q://QID16ChoiceTextEntryValue, q://QID17ChoiceTextEntryValue, q://QID18ChoiceTextEntryValue)}
Any suggestions will be welcome.
Thank you.
Page 1 / 1
you can use simple if conditions or java script to punch max value from 3 numbers.
Hello @Shashi ,
I know how to use Redirect to URL option. But I want to know how to detect the maximum value of reported answers and then redirect the respondent based on the value.
I know how to use Redirect to URL option. But I want to know how to detect the maximum value of reported answers and then redirect the respondent based on the value.
JS:
```
var max = Math.max(parseInt("${q://QID16ChoiceTextEntryValue"), parseInt("${q://QID17ChoiceTextEntryValue}"), parseInt("${q://QID18ChoiceTextEntryValue)}"));
Qualtrics.SurveyEngine.setEmbeddedData("max", max);
```
In survey flow branch: If max > X etc.
```
var max = Math.max(parseInt("${q://QID16ChoiceTextEntryValue"), parseInt("${q://QID17ChoiceTextEntryValue}"), parseInt("${q://QID18ChoiceTextEntryValue)}"));
Qualtrics.SurveyEngine.setEmbeddedData("max", max);
```
In survey flow branch: If max > X etc.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.