Hello!
I will start a longitudinal study with 3 time points. We have planned to generate an individual code that will allow us to identify each participant at T1, T2 and T3, ensuring his anonymity. This code consists on 4 elements that comes from 4 questions (e.g.: first letter of first mother's name, birthday day, ...). Considering our target population, it is easier to ask the 4 questions individually, rather than asking to the participant to write the final code based on those informations.
Is there any way of Qualtrics automatically generate this code from the participant's answers? And to consider it as an ID?
Thank you very much!
Best,
Inês
Page 1 / 1
String manipulations are not possible in Qualtrics, you'll need to use JS. The following code will work for you if you only ask those specific question and in the correct order. It will create an embedded variable called
codewhich you can use in the survey.
Qualtrics.SurveyEngine.addOnReady(function () {
that = this;
document.querySelector("#NextButton").onclick = function (){
person_code = [];
entries = that.getChoiceContainer().querySelectorAll("input");
entries.forEach(item => person_code.push(item.value.charAt(0)));
Qualtrics.SurveyEngine.setEmbeddedData("code", person_code.join(""));
}
});
Dear ahmedA,
Thank you so much! It is that the case, always the same questions and the same order. But I need to back to basis, I'm a new qualtrics user... Where should I put the code that you have mentioned?
Thank you very much for your help!
Ref for details
Thank you very much!!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.