Multi-punch Embedded Data | XM Community
Skip to main content

I have a question with 30 attributes that someone can select up to 5 of the attributes. I’m trying to categorize the attributes in the survey flow with embedded data. The problem that I’m having is if a person selects attributes in two different categories, it only puts them in the first category. I have the embedded data set as multi-select but still the same thing. 

Hey @jstoppa

I am not sure  what your expected outcome is but if you want to have one embedded data field “Category” which contains all categories (e.g. concatenated by comma), you could…

  1. Define the embedded data field “Category” in the survey flow as multi-value text set
  2. Better use recode values for the attribute question
  3. Place some JavaScript to fill the embedded data field with all matching categories concatenacted by comma
Qualtrics.SurveyEngine.addOnload(function() {
var selectedAttributes = "${q://QIDXX/SelectedChoicesRecode}"; // Replace QIDXX with your question ID
var categories = ];

if (selectedAttributes.includes("Attribute1") || selectedAttributes.includes("Attribute2")) {
categories.push("Category1");
}
if (selectedAttributes.includes("Attribute6") || selectedAttributes.includes("Attribute7")) {
categories.push("Category2");
}

// Set embedded data
var categoryString = categories.join(",");
Qualtrics.SurveyEngine.setEmbeddedData("Category", categoryString);
});

Another option would be to define branch logic in the survey flow:

Survey Flow:
Embedded Data:
- Category: ""
Branch Logic:
If SelectedAttributes contains Attribute1 OR Attribute2 OR Attribute3 (Category1 attributes)
- Set Embedded Data Category to EmbeddedData.Category + "Category1,"
If SelectedAttributes contains Attribute6 OR Attribute7 OR Attribute8 (Category2 attributes)
- Set Embedded Data Category to EmbeddedData.Category + "Category2,"

Best
Christian


Leave a Reply