Hello,
I have a metadata BirthOfDate format (YYYY-MM-DD).
I need to create an embedded data based on this Birth Date to have only the Year of date. Embedded data YearBirth = YYYY
Could you please help me to do that ?
Thanks.
Quentin
Hello,
I have a metadata BirthOfDate format (YYYY-MM-DD).
I need to create an embedded data based on this Birth Date to have only the Year of date. Embedded data YearBirth = YYYY
Could you please help me to do that ?
Thanks.
Quentin
Best answer by chackbusch
Hey
you would need at least one question before you need the year, e.g. like this:

The two questions need to have a page break in between or need to be placed in two different blocks.
Within some question before the one you need the year in, you would need this JavaScript code (highlighted in the screenshot above):
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
let birthDate = Qualtrics.SurveyEngine.getEmbeddedData( 'birthDate' );
let birthYear = birthDate.substring(0,4)
Qualtrics.SurveyEngine.setEmbeddedData( 'birthYear', birthYear );
});In the survey flow, the setup should be like this:

In my example, the piped text is correctly set:

Hope it works for you as well.
Best
Christian
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
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.