Hi, We are new to this and my question is probably very basic. We are using moment.js to calculate a time period based on a user's response. The browser console.log shows that moment.js is calculating the days correctly, but we are not able to access the data that we set. How do we call these dates that we set as embedded variables in subsequent blocks as piped text in a question? It this not possible? I don't think we have successfully called up an embedded variable that we set with javascript so I think there is something that we are not understanding.
We would like a subsequent question later in the survey to include the earliestDay and latestDay variables in the question.
var daysAgoo = "${q://QID47/ChoiceGroup/SelectedChoices}";
var today = moment();
var monthFromToday = moment(today).add(1, 'months');
var targetDate = moment(monthFromToday).subtract(daysAgoo, 'days');
var earliestDay = moment(targetDate).subtract(6, 'days');
var latestDay = moment(targetDate).add(6, 'days');
targetDate= moment(targetDate).format('LL');
earliestDay= moment(earliestDay).format('LL');
latestDay= moment(latestDay).format('LL');
Qualtrics.SurveyEngine.setEmbeddedData('targetDate ', targetDate );
Qualtrics.SurveyEngine.setEmbeddedData('earliestDay', earliestDay);
Qualtrics.SurveyEngine.setEmbeddedData('latestDay', latestDay);
console.log(targetDate);
console.log(earliestDay);
console.log(latestDay);
How do you call up Embedded data set by javascript into a question?
Best answer by mmoore
Did you already define your variables in an Embedded Data element in your survey flow? If not, then you need to use .addEmbeddedData instead of .setEmbeddedData. Once you do that, you should be able to reference them normally using ${e://Field/variablename}.
I have also always used double quotes (instead of single) around the embedded data variable name when adding/setting, but I'm not sure if that matters or not.
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.
