Using csv and javascript data to display specific rows in side-by-side matrix | XM Community
Skip to main content

Hi there, I'm wondering if there is a custom javascript code that could help me. I have a csv file listing all US States (in column 1) and their counties (column 2). I want to ask participants to select their state (Q1), and then this will display only the correct counties for their state in a side-by-side matrix (Q2), where they can rate services in each county.
For my first question (Q1) I am using a pick list question for US State. My second question is a side-by-side matrix (Q2) with all the relevant counties. I would like to only show the relevant counties per state, rather than display the whole list.
I was thinking I could use a hidden variable or something, to use the data from my csv file, but was not sure the best way to do this. Would I need to use my CSV file to create drill down questions with the uploaded data lists, and somehow link them to the Q2 side-by-side matrix, using javascript? I just want to avoid manually creating different matrices for each state and manually putting in skip logic. If this could be dynamic, using javascript that would be ideal.
Any advice is appreciated!
Q1_2.png

Why don't you use drill down question type and everything will be taken care by Qualtrics itself. In a nutshell it will directly filter all the required counties for that particular state which will show 2 drop downs in your case and drill the values to be shown specific to the state selected.
You may read more about drill down question type below.
https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/question-types-guide/specialty-questions/drill-down/


grahulp5 Thanks for the suggestion. Yes indeed the drill down questions can filter and show the counties based on the state, but what I'm not sure of is how I can get all of those counties (per state) to show up in a side-by-side matrix, without adding skip logic for every single row (there's almost 2000). Any thoughts on that?


LauraCeleste First you will need to create a csv file of counties as state in the first column and then second one will have counties so the state name would be common.


Yes, I already had that.


LauraCeleste,
You could set up your SBS row labels like this:

Then use a change event on your drop-down to show the rows in the SBS where span class matches the state selected.


Leave a Reply