I have an ED field with a date, how do I make a new ED field with just the year from that date?
Basically I have an ED field for date that is in this format MM/DD/YYYY. I would like to create a new ED field that just contains the YYYY portion of the first ED field so I can do a results report breakout by Year. Can this be done in Qualtrics or do I need to export to Excel then import?
refer below post too
https://www.qualtrics.com/community/discussion/475/how-to-split-a-string-using-2-different-separators
`var dob_entry = getTextValue();
var split_dob = dob_entry.split("/");
var month = split_dob[0];
var day = split_dob[1];
var year = split_dob[2];`
https://www.qualtrics.com/community/discussion/475/how-to-split-a-string-using-2-different-separators
`var dob_entry = getTextValue();
var split_dob = dob_entry.split("/");
var month = split_dob[0];
var day = split_dob[1];
var year = split_dob[2];`
You will first have to create an embedded data "CurrentYear" in survey flow and then add below code in JavaScript part "onReady" section
var CurrentYear1 = "${date://CurrentDate/SL}";
CurrentYear1 = CurrentYear1.split("/");
var CurrentYear2 = CurrentYear1[2];
Qualtrics.SurveyEngine.setEmbeddedData("CurrentYear",CurrentYear2);
var CurrentYear1 = "${date://CurrentDate/SL}";
CurrentYear1 = CurrentYear1.split("/");
var CurrentYear2 = CurrentYear1[2];
Qualtrics.SurveyEngine.setEmbeddedData("CurrentYear",CurrentYear2);
Leave a Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.