Using Variables in Javascript Piped Text | XM Community
Skip to main content

Hi everyone,
I am trying to record the values of multiple questions using piped text, based on a variable. A simple example that doesn't work correctly for me:

id = 'QID191'

i1 = '${q://'+id+'/SelectedAnswerRecode/1}'

whereas this code functions just fine:
i1 = '${q://QID191/SelectedAnswerRecode/1}'

I assume this has something to do with how the strings/piped text get parsed in Javascript, but I've tried searching around for some solutions without too much success. Thanks!

This is most likely due to how template literals are evaluated in Javascript.
Perhaps you could try around with

eval()
.


https://www.qualtrics.com/community/discussion/14096/using-variables-in-javascript-piped-textPiped fields are resolved on the server before they are sent to the browser. So, you can't dynamically create piped fields in JS.


Leave a Reply