Hi, I'm fairly new to Qualtrics (and have zero (0) knowledge about JavaScript) so here I am because I couldn't find an answer :,)
Context:
For my survey, respondents have to read 30+ vignettes. After each vignette, respondents have to answer 3 questions (which are the same for all vignettes). So each vignette + 3 standard qns have to be in a block.
The presentation of the vignette-blocks will be randomised, but respondents must read & respond to all of them.
Problem:
Every vignette contains a fictional person's name. I have a list of fictional names to be presented to respondents, and would like the name displayed in each vignette to be randomised. (e.g., Respondent 1 would see 'Tom' for Vig.1 & 'Harry' for Vig.2; respondent 2 would see 'Harry' for Vig.1 & 'Tom' for Vig.2) Each name can only appear once per respondent.
From my understanding, use of embedded data and piped text are the most efficient ways to achieve this. However, while I have tried many different methods, so far I cannot figure out how to:
(a) display a different name for each vignette -- I tried inserting a Randomiser element, but all the vignettes ended up displaying the one randomly selected name; and
(b) ensure that each fictional name appears only once across all the vignettes.
(c) I was also wondering if it was possible to insert the same name twice in the vignette, something like:
^Hence, the same name would have to be displayed within each vignette.
My priorities are to achieve (a) and (b); (c) is ideal but optional!
Thank you so much in advance :") If the solution requires JS I will learn it.......
Randomise the embedded data to be shown in piped text across different questions
Best answer by TomG
You need to randomly assign 30 unique names to unique embedded fields and pipe them into your vignettes (i.e., field name1 piped into vignette 1, name2 piped into vignette 2, etc.). One way to do this:
- Sometime before the first vignette, create a MC question with the 30 names as choices
- Randomize the choices
- Add JS to the question to loop through the choices and save the choice labels (i.e., the names) into embedded data fields (name1, name2, etc.)
- Use JS to hide the question
BTW, you could use a loop and merge block to do all the vignettes in one block.
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

This is the MC question with the vignettes:
This is the JS code you provided:
Now, this works perfectly. However, I have 8 vignettes in total and I am using 4 of them in this aforementioned block and the next 4 I use in the 2nd block. The second block looks the same but Field 6 is different:
Unfortunately, this does not work at all in the second block. It seems like whenever I pipe in Field 6, one vignette repeats itself constantly even though it has already been displayed in the previous block. Do you have any idea why this could happen?
The last thing that came to mind is just to put everything in one block. But then, I couldn't do the randomization within gender and whether male or female comes first (except maybe in case there is a way of an if condition within loops through javascript?)...