Search code examples
javascriptqualtrics

Add in custom text to a qstn based on variable in Qualtrics


I have a question in a survey in which I want to change a read-in based on a variable. Here is an example question: Were you involved in the decision to install a at your [IF LOCATIONS=0, READ "organization" [IF LOCATIONS>1, READ “facility at <ADDRESS>"]?

I know that I can create a variable in my dataset that says "organization", or that copies over their address and says "acility at ". I'm interested in programming this logic into the Qualtrics survey (through javascript, if necessary).


Solution

  • Assuming you have embedded variables LOCATIONS and ADDRESS, create a variable to pipe in your survey flow and pipe it into your question.

    In survey flow before block containing question:

    if LOCATIONS = 0
      org_loc_pipe = organization
    if LOCATIONS > 0
      org_loc_pipe = facility at ${e://Field/ADDRESS}
    

    Then your question becomes:

    Were you involved in the decision to install a at your ${e://Field/org_loc_pipe}