How to extract parts of embedded data field and save as new variable? | XM Community
Skip to main content

Hello,
I am using the embedded data field "Q_URL", which stores the URL that the respondent used to participate in the survey, to monitor how many respondents I have for each target group (each target has its own url). The url contains hundreds of letters and digits, but in my link I am only interested in the last 6 digits in the URL. Is there a way to extract the last 6 digits of the Q_URL into a new variable in Qualtrics?
Thanks,
Timmy

You could pull the embedded data into a javascript code to grab your requirement then save it as another embedded data variable.


Hi Pogi,
Yes I would assume that it takes javascript to solve it, however I don't know how to write it. Do you?
Thanks,
Timmy


I'm not a coder. I just search the web until I find something that looks like it will work and I try it.
Qualtrics uses jQuery by default. I found this resource that may help you get started.
How to Get Substring from a String Using jQuery (tutorialrepublic.com)
You will have use the javascript question API: Qualtrics JavaScript Question API - Qualtrics Question API
If you try something and it still doesn't work, you can post your code here and I can try to look it over.


Ok, thanks! I'll play around with it.


Leave a Reply