Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
EugeniaCastillaFragoso
Partner - Contributor III
Partner - Contributor III

Divide text in multiple lines

Hello!

I have the following issue, I have a dimmension that contains really long strings. A client has asked to divide that text in multiple lines, to read the information better.

Ex:

What I have: aaaaaaaaasssssssssdwwwddddddddddddddssssssssssssssssfewwwwwwwwwgriiiiiiiiijjjjjjjjjjjjjjjjjgrrrr

What I want:

aaaaaaaaaaaaaaaasss

sssdwwwdddddddddddddd

dssssssssssssssssfew

ssfewwwwwwwwwgriiiiiiiii

ijjjjjjjjjjjjjjjjjgrrrr

 

There is no separation parameter in the string.

 

does anyone have any suggestions as to how I may do this? 

6 Replies
mato32188
Specialist
Specialist

Hi  @EugeniaCastillaFragoso,

perhaps this could help you

mato32188_0-1620896321747.png

 

BR

m

ECG line chart is the most important visualization in your life.
EugeniaCastillaFragoso
Partner - Contributor III
Partner - Contributor III
Author

Hi @mato32188 , that unfortunately won't do it, as some text won't even fit like that, and plus, think this is a dynamic table, so sometimes that dimension is displayed and sometimes it isn't. So it is not the best thing to have super thick columns when that dimesnion isn't showing...
I don't know if you know of any loops to devide the text in let's say, 60 char or something like that 😞 

tresesco
MVP
MVP

Not sure if you are looking for something like below:

Let vLength=10;   // set your value to 60 or so

Load
String,
Mid(String, $(vLength)*(IterNo()-1)+1,$(vLength)) as StringBroken
While len(String)>=$(vLength)*(IterNo()-1);

Load * Inline [
String
aaaaaaaaasssssssssdwwwddddddddddddddssssssssssssssssfewwwwwwwwwgriiiiiiiiijjjjjjjjjjjjjjjjjgrrrr
]

tresesco_0-1620905154040.png

 

mato32188
Specialist
Specialist

Hi @EugeniaCastillaFragoso ,

you can try to play a bit with chr(10) function that returns line feed, i.e.

mid(String,0,len(String)/2)&chr(10)&mid(String,len(String)/2,len(String))

m

ECG line chart is the most important visualization in your life.
EugeniaCastillaFragoso
Partner - Contributor III
Partner - Contributor III
Author

Hello @tresesco , thank you for your reply, unfortunately, this doesn't work for me. I want the text to still be one 'item' of the dimension 'String'.

What i want is to insert a chr(10) every each 60 char or so, so the text appears to be in many lines, not all in one