Search code examples
javascriptqualtrics

How do I create a global variable in Qualtrics Question Text?


How do I create a variable to use in my text using a Qualtrics survey in multiple questions? I am not using any embedded data or making variations. The variable would be for the sole purpose of editing future drafts of my survey more efficiently. For example I want something like:

myvar = 100

Q1. If you have %myvar% and I take away 50 how much is left?

Q2. If you have %myvar% and I give you 70 how much do you get?

...

The more thorough the explanation the better!


Solution

  • You don't need any JavaScript for this. What you want to do is very easy in Qualtrics.

    First, at the beginning of your survey flow assign a value to an embedded data field:

    myvar = 100
    

    Then pipe the value into your question text like:

    Q1. If you have ${e://Field/myvar} and I take away 50 how much is left?