Display Embedded Data Values as a Bulleted List from Side-by-Side Question | XM Community
Skip to main content

Hi folks

I’m working on a follow-up survey question where I want to display embedded data (strand1q1nos) as a bulleted list. This embedded data comes from a side-by-side question earlier in my survey. Specifically, the piped text ${e://Field/strand1q1nos} contains a comma-separated list of all row labels corresponding to rows where the respondent selected "No" in column 1 of that side-by-side question.

My initial JavaScript snippet (below) splits this embedded data string on commas to build the list, and it works fine as long as individual items do not contain commas themselves:

 

I opted for this embedded data approach because I also tried parsing the data based on index values to handle the commas embedded  but that was too complicated for me and did not work reliably as the QIDs were not dependable for consistent indexing.

My goal is to find a reliable and straightforward approach that can correctly parse and display embedded data as a list regardless of whether it contains commas

For context, within my follow-up question, I include this HTML container to  display the list:
<div id="list-container" style="margin-top:10px;"></div>

Any suggestions on best practices, JavaScript strategies, or code examples to handle embedded data containing commas, newlines, or other special characters would be greatly appreciated.

Any suggestions or example code on how to do  would be greatly appreciated.

Thank you.

Are you using code to create strand1q1nos? What is it?

Two ideas:

  1. You could use something other than , to delimit the fields (e.g., |) in strand1q1nos
  2. You could remove or replace characters that you don’t want displayed in embeddedVal before you split it.

Hey Thanks Tom.  Not using code to create strand1qnos. It  is an embedded data field from  piped text of the row labels based on users’ selected no values to all the statements in column 1.


Hey Thanks Tom.  Not using code to create strand1qnos. It  is an embedded data field from  piped text of the row labels based on users’ selected no values to all the statements in column 1.

Split embeddedVal on “, “ (comma + space) and add the html entity &ZeroWidthSpace; immediately after each comma in your row labels.