Identification code on a longitudinal study | XM Community
Skip to main content
Solved

Identification code on a longitudinal study


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

Best answer by ahmedA

Ref for details

View original

4 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • January 14, 2021

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

code 
which 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(""));
}
});


  • Author
  • 2 replies
  • January 14, 2021

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!


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • Answer
  • January 14, 2021

Ref for details


  • Author
  • 2 replies
  • January 15, 2021

Thank you very much!!


Leave a Reply