Sorry for a basic question, but I want to set embedded data based on user input. For example, if a user enters 48 for their age (question is called “age”), how do I set a value for age + 10? The survey should display 58 in this case.
I’m currently trying the below in the “Set Embedded Data” area under survey flow. age is entered in a block that precedes the embedded data part.
AgeVar = $e{ e://Field/age + 4 }
Page 1 / 1
@Solmike : To set embedded data based on user input in Qualtrics and add 10 to the user's age, you can use the following syntax in the "Set Embedded Data" section under Survey Flow:
AgeVar = ${e://Field/age} + 10
@Solmike It should be $e{ q://QID1/ChoiceTextEntryValue + 10 } change QID acording to yours. Field is used for Embedded Data, not Survey Answer Let me know if it helps
@Solmike
There are 2 solutions
Create a embedded data “Age” in survey flow. Add the below java script to a question next to the open ended/form field question. Note: There should be a page break between these 2 questions for the code task to work.
Qualtrics.SurveyEngine.addOnload(function()
{ var age = parseInt("${q://QID2/ChoiceTextEntryValue}") var updatedage = age + 10 Qualtrics.SurveyEngine.setEmbeddedData('Age', updatedage)
Thanks for all the helpful responses, great community! I haven’t tried all these yet but will send an update when I find something that works.
My question IDs and even variable names seem to be changing now that I have created so many fields and tried so many different solutions! For example, instead of “age” in my dataset, I now see “age_4”. Don’t see how to change it.
Thanks again to all! I had two “best” responses, so not sure which to pick.
“dxconnamnguyen” had the closest syntax, but I had to use something slightly different. In my case, this worked: “AgeVar = $e{q://QID1316368706/ChoiceNumericEntryValue/4 + 10}”
“Imran_Ansari” provided the link that ultimately got me to the correct answer; I had to use piped text to get the question ID (appears different in my data output) and correct wording. I took that info and used embedded data to calculate the value I needed.
Thanks again! Was a headache but is working now.
Thanks again to all! I had two “best” responses, so not sure which to pick.
“dxconnamnguyen” had the closest syntax, but I had to use something slightly different. In my case, this worked: “AgeVar = $e{q://QID1316368706/ChoiceNumericEntryValue/4 + 10}”
“Imran_Ansari” provided the link that ultimately got me to the correct answer; I had to use piped text to get the question ID (appears different in my data output) and correct wording. I took that info and used embedded data to calculate the value I needed.