Identification code on a longitudinal study | XM Community
Solved

Identification code on a longitudinal study

  • 14 January 2021
  • 4 replies
  • 20 views

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

icon

Best answer by ahmedA 14 January 2021, 21:25

View original

4 replies

Userlevel 7
Badge +21

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

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!

Userlevel 7
Badge +21

Ref for details

Thank you very much!!

Leave a Reply