Hi! I'm looking to create a survey that has dynamic values embedded in a matrix table. The setup I'm looking for is as follows:
I upload a CSV to Qualtrics with one column containing a certain number of phrases, each in its own row. I then read these phrases into my survey via JS and create a dynamic matrix table where the scale points remain the same, but the statements change depending on the CSV uploaded.
For example, if I upload a CSV with the values "Q1", "Q2", "Q3", the matrix table should look like this:
If I upload a CSV with the values "X", "Y", "Z", it should look like this:
In case it matters: the reason for this design is that I have a very large set of questions (say, 10k+) that I would like to pre-divide into subgroups of 100 each so I can then select one subgroup within each survey and display those questions within a matrix table. This could in theory be done with survey flow logic, but it would require a ton of manual cases and I'd much rather program an efficient solution in JS.
Please let me know what the easiest way would be to achieve this. Thanks!
You can set an embedded data field for each matrix row then pipe that value into your matrix statements (row labels). Like:
${e://Field/row1}
${e://Field/row2}
${e://Field/row3}
The best way would be to upload your csv into a database table on a web server, then use a web service to assign values to the row embedded fields (row1, row2, etc.).
Alternatively, you could convert your csv to a JS object and use JS to assign the embedded fields. With this approach, you would separately need to define the embedded fields in the survey flow if you want the values saved in your Qualtrics data.
TomG Thank you for the response! I appreciate it.
Let me clarify my question a little. I don't need to save the values for each row, since I will have those stored externally. I will only need to save one embedded datapoint to indicate which subgroup was displayed for that particular respondent.
My goal (in very rough pseudocode) looks like this:
array rowVals = read_csv("subgroup1.csv");
int numRows = rowVals.length;
for (int i = 0; i < numRows; i++) {
// set the row label (statement value) for row i to rowVals[i]
}
where the spreadsheets subgroup1.csv, ..., subgroup100.csv are saved in my Qualtrics file library.
The primary hurdles are (a) reading a CSV from my library via JS, and (b) setting the row values themselves. I think I understand the gist of your suggestion, but I'm unfamiliar with the syntax for reading in a CSV or assigning matrix-table row values within Qualtrics JS. If you could provide some basic examples that would be great.
Thank you again for the help!
TomG Bumping this, it would be awesome to have a little more guidance here. Thank you!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.