Javascript code for repeating terms in one block | XM Community
Skip to main content

Hi everyone!

Does someone know how to use Javascript and Qualtrics together for this: I am working on a study where participants have to rate different illnesses (they first read a description of an illness, followed by questions regarding that illness and so on). Is there a javascript code for not manually writing the illness name in every question in the block ? It is a large data set so I would really appreciate help!

Not sure you need JavaScript. Set an embedded value in the survey flow prior to the block then pipe it into your questions.

Embedded Data: illness = Flu

Then pipe it into your questions as ${e://Field/illness}.


Thank you for your answer 🙂 ! I would love to do that but to be honest I am not sure if that works with my current survey flow. In one condition (group) there are several illnesses (blocks) and if I add another embedded data field before the blocks I would have the same for all illnesses (blocks) right (illness - Flu)? 

 

 


If you use a different embedded data field for each illness, you can set them all at the beginning:

illness1 = X

illness2 = Y

illness3 = Z

Then pipe the illnesses in their respective blocks.

Or, if you want to use one embedded data field, set it before each ‘Illness’ block.

Group 1

   Set Embedded Data:

       Condition = 1

        Illness = X

    Show Block: Illness 1

    Set Embedded Data: Illness = Y

    Show Block: Illness 2


Thanks so much! Now it works!


Leave a Reply