Solved
Inserting month as piped text

I am trying to insert the name of the current month into a question so that it updates automatically. In a verbally-administered survey, the question reads:
> For these statements, please tell me whether the statement was often true, sometimes true, or never true for you in the last 12 months—that is, since last (name of current month).
Essentially, I just want to insert the current month in place of those parentheses. I figure the way to do this is with piped text, but the only date options I am finding that way include the day and year, not just the month name.
Any suggestions on the most efficient way to insert just the current month name?
> For these statements, please tell me whether the statement was often true, sometimes true, or never true for you in the last 12 months—that is, since last (name of current month).
Essentially, I just want to insert the current month in place of those parentheses. I figure the way to do this is with piped text, but the only date options I am finding that way include the day and year, not just the month name.
Any suggestions on the most efficient way to insert just the current month name?
Best answer by Anonymous
Hello @smckee ,
Step1: Make a embedded data(month) in survey flow before the question
Step2: Paste the below code in the one previous question (js option) to the required question.
const monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
const d = new Date();
var n=monthNames[d.getMonth()];
Qualtrics.SurveyEngine.setEmbeddedData( 'month', n );
Step3: Now pipe embedded data "month"
View originalStep1: Make a embedded data(month) in survey flow before the question
Step2: Paste the below code in the one previous question (js option) to the required question.
const monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
const d = new Date();
var n=monthNames[d.getMonth()];
Qualtrics.SurveyEngine.setEmbeddedData( 'month', n );
Step3: Now pipe embedded data "month"
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.