Displaying multiple lines of embedded data | XM Community
Solved

Displaying multiple lines of embedded data

  • 14 July 2020
  • 7 replies
  • 121 views

Badge +1

I have embedded data in my contact records that contains line returns. It is essentially a list of items that I want to show in my question text. Each contact has a different number of items and they are each separated by a line return. So the question would look like
This is the information we have for you account:
Item 1
Item 2
Item 3
... Item n
Is this correct? Y/N

When i used pipe text in the question to show the embedded data - only the first item shows up - everything after the first line return seems to be truncated. When I look at the contact I can see the data in the contact record.
I have control over the embedded data and I could encode it differently if that will help but at the moment each item is separated by a line return Char(10).
Is there anyway to get this data to show correctly?

icon

Best answer by TomG 15 July 2020, 17:03

View original

7 replies

Userlevel 7
Badge +27

I'm surprise it is truncated and not displaying as one continuous string. I've stored and retrieved contact data with line feeds and haven't had an issue.
First, make sure the embedded data type is Text. Next, I would pipe your embedded data field into JS and look at it in the browser console.
console.log("${e://Field/myfield}");
If you see the entire string in the console (it isn't truncated), then you can use JS to convert the line feeds to html breaks:
jQuery("#newPipe").html("${e://Field/myfield}".replace(/\\n/g,"
");)
Add the following to your question html where you want the pipe displayed:


Badge +1

Thanks for feedback - I'm not entirely sure how to implement the steps you've suggested.
I have confirmed the embedded data is stored as Text.
The piping to console is eluding me. tried to put
console.log("${e://Field/myfield}");
into my question HTML but I don't think that's what you intended.
As for adding Jscript to my questions - I'll need to do some research as to how to do that.

Userlevel 7
Badge +27

con
https://www.qualtrics.com/community/discussion/comment/27889#Comment_27889To add JavaScript, click on the cog next to the question and choose "Add JavaScript"
console.log is a JavaScript function. When you preview your survey, right click on the Question, choose Inspect, then from the Inspect window, click on the Console tab.

Badge +1

Thanks again Tom - I did finally get the console log to do what you suggested.
Unfortunately - it does look like the data is being truncated. Only the first line of the data is showing.
I wonder if I should to load the embedded data differently.

Post Script:
I just exported the contact list and discovered that the embedded data is missing. So it appears to be there when examining the data in the contact list but it is not associated with the Embedded data Column as I expected... So I think the answer is I need to import the data differently.



Badge +1

Trying to add the script suggested and I get an error unexpected token }
Capture.JPG

Userlevel 7
Badge +27

You're missing a semi-colon at the end of the jQuery line.

Badge +1

Ignore the above - I figured out the syntax errors and I got the embedded data problem sorted out. The data is there.
The piped field shows the data in a single line as expected. The


Is resulting in nothing - just blank.

Leave a Reply