Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Line break in script

Hi,

Is it possible to make a line break in the script? I use field values loaded in the script in a graph as axis values. The field values are text string and the length of the string needs to be divided in two rows. example:

Load inline [

nr,          Data

1            abcdefghij klmn opqrst .....  

what i would like to do is to insert a line break in field Data. The length of the string makes it difficoult to show on a graph axis.

Best regards

Anders

1 Solution

Accepted Solutions
morganaaron
Specialist
Specialist

Hi Anders,

Which of the options are you using? If it's the SubField script, putting:

& chr(10) & SubField(Data,' '.3) after the above statement should work.


Actually, just thought of a much simpler option. Use: Replace(Data,' ',chr(10)) instead - this will replace any space with a line break. Not sure how many this would take before running out of line space though!

If it's using the Left/Right statements you'll need to introduce a "Mid" statement as well - let me know if that's the case.

View solution in original post

5 Replies
morganaaron
Specialist
Specialist

Hi Anders,

If you need to divide it into two rows based on a count of characters or a split, use a calculated dimension. For a count use:

=Left(Data, X) & chr(10) & Right(Data, len(Data)-X) replacing X with however many characters you want on the first line.

If you want to break at every space, use:

=SubField(Data,' ',1) & chr(10) & SubField(Data,' ',2)...etc for however many spaces/rows you want.

If then in the axes tab you set the Dimension Axis labels to / or | you'll get all the lines appearing with the line breaks.

giacomom
Partner - Contributor III
Partner - Contributor III

Hi Anders,

in addition to what Aaron says, if you just want to show part of the string (the first n characters) just to make the chart axis more readable instead, you can set the legend limit number in the Presentation tab of the chart properties window, as showed in the figure below:

Capture.PNG.png

Regards,

Giacomo

Not applicable
Author

almost there, i try to make 3 line breaks. 2 works fine but when i make 3 the text dissappear.

suggestions?

morganaaron
Specialist
Specialist

Hi Anders,

Which of the options are you using? If it's the SubField script, putting:

& chr(10) & SubField(Data,' '.3) after the above statement should work.


Actually, just thought of a much simpler option. Use: Replace(Data,' ',chr(10)) instead - this will replace any space with a line break. Not sure how many this would take before running out of line space though!

If it's using the Left/Right statements you'll need to introduce a "Mid" statement as well - let me know if that's the case.

Not applicable
Author

thanks Aaron

Kind regards

Anders