GENERATE RANDOMISE DATE FOR TEST | XM Community
Skip to main content

Hello,
is-it possible to generate randomise data and how ?
i want check my survey filters.
Thanks for help

Mor_lvdc
You cannot generate it OOTB, but by creating 3 random numbers in 3 different embedded dataand creating it in a manner like (22-22-2022) manually or you can include the below JS which will do the work for you.
"Qualtrics.SurveyEngine.addOnload(function()
{
function randomDate(start, end) {
 var date;
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
}
const d1 = randomDate(new Date(2012, 0, 1), new Date());
var d = d1.toISOString().substring(0, 10);
Qualtrics.SurveyEngine.setEmbeddedData("date",d);
});"
Just create an embedded data "date" in your survey flow and it will be populated.

Hope this helps!


that will create data for my variables ?
and how i incorporate the js?


Mor_lvdc
I thought you wanted random dates (as in your title) and not random data
The JS will create randomized dates and populate the variable "date" for you. You can include JS as mentioned here (Add JavaScript (qualtrics.com)).
If you want to generate test data for your survey you can follow this support page.
Hope this helps!


Sorry mistake on my title :)
thanks a lot for your answer.


Mor_lvdc,
Yes, you can generate random test data. See:
Generate Test Responses


Looks like both Deepak and TomG arrived at the same solution with the support page! Thank you guys for incredible contributions to the community! 😊


Leave a Reply