How to capture the index for answer to drill down question | XM Community
Skip to main content
Solved

How to capture the index for answer to drill down question

  • March 3, 2025
  • 1 reply
  • 20 views

Forum|alt.badge.img+2

I have a drill down question where the first level asks the participant to select a county. I would like to save the index value for the county that the participant selects into an embedded data field called “CountyPick.” 

Right now I have this code:

     var CountySelection = " ${q://QID23/ChoiceGroup/SelectedAnswers/1}"
     Qualtrics.SurveyEngine.setEmbeddedData('CountyPick', CountySelection);    

 

This is saving the name of the county, instead of the index value for the county. Does anyone know how I can capture the index?

 

 

 

Best answer by surrogate-key

 

In case anyone else is looking for something like this, I ended up using:
 

   var CountySelection = jQuery("#"+this.questionId+" select").eq(0).val();
   Qualtrics.SurveyEngine.setEmbeddedData('CountyPick', CountySelection);    

 

 

 

View original

1 reply

Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 7 replies
  • Answer
  • March 4, 2025

 

In case anyone else is looking for something like this, I ended up using:
 

   var CountySelection = jQuery("#"+this.questionId+" select").eq(0).val();
   Qualtrics.SurveyEngine.setEmbeddedData('CountyPick', CountySelection);