Dynamic new line in narrative

Hey Quicksight experts. I am trying to insert multiple urls in narrative dynamically. I get data from Athena. My url field looks like this: https://urlreference1.com\nhttps://urlreference2.com I need to insert those urls which is divided by ‘\n’ one on each new line. Is there a way to do that?

It could be not new line, the main idea is to separate multiple urls that came from Athena to working clickable representation, so if you click on any of those urls it open in new tab.

Hi @armenadamyan - I dont think this is going to be possible. The narrative editor nor the visuals are going to interpret \n as a new line or value. You could use the split() function to split these strings into multiple values, but be aware this will result in multiple fields. You could put those multiple fields into a table and them style them as clickable hyperlinks, but without knowing what you are trying to make your narrative look like Im not sure if that meets your needs.

Formula to take first URL would be:
split({your field}, “\n”, 1)

Second URL would be:
split({your field}, “\n”, 2)

And so on.

1 Like

Hi @Jesse, the table could work for me but in my case I do not know exact number of urls that came in from data it can defer from 1 to 61, so it can be 1 url or 61 urls in table. How to generate calculated field which will go over data and split them, so I can see them one by one in my table.

Since the number of values in the string is unknown, it will be difficult to do this in calculated fields. We need to do this recursively in a data prep layer before building the dataset in QuickSight. I am not a SQL expert, but I think you should be able to use something like a Recursive CTE in your SQL statement to split those values into multiple rows (or maybe columns).

1 Like