<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Inserting Line Breaks in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236845#M87974</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the attached for an idea.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;data:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;data&lt;BR /&gt;1234567890ABCDEFGHIJKLMNOP&lt;BR /&gt;A long line the goes on and on&lt;BR /&gt;]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;SET crlf = 'chr(10) &amp;amp; chr(13)';&lt;BR /&gt;SET size = 7; // Break every seven chars&lt;/P&gt;&lt;P&gt;segments:&lt;BR /&gt;LOAD&lt;BR /&gt; recno() as recno,&lt;BR /&gt; iterno() as segkey,&lt;BR /&gt; mid(data, ((iterno()-1) * $(size))+1, $(size) ) as segment&lt;BR /&gt;RESIDENT data&lt;BR /&gt;WHILE iterno() * $(size) &amp;lt; len(data)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;final:&lt;BR /&gt;LOAD concat(segment, $(crlf), segkey) as finaldata&lt;BR /&gt;RESIDENT segments&lt;BR /&gt;GROUP BY recno&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;DROP TABLE data;&lt;BR /&gt;DROP TABLE segments;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 May 2010 05:50:06 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2010-05-11T05:50:06Z</dc:date>
    <item>
      <title>Inserting Line Breaks</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236844#M87973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In script, I would like to insert a line break every 74 bytes into a text field that is up to 32000 bytes. Here is my current solution:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;LET InsertLineBreaks = '';&lt;BR /&gt;FOR I = 0 TO 500&lt;BR /&gt; LET InsertLineBreaks = InsertLineBreaks &amp;amp; '&amp;amp;' &amp;amp; chr(39) &amp;amp; chr(10) &amp;amp; chr(13) &amp;amp; chr(39) &amp;amp; '&amp;amp;mid($1,1+' &amp;amp; $(I) &amp;amp; '*$2,$2)';&lt;BR /&gt;NEXT&lt;BR /&gt;LET InsertLineBreaks = ' ' &amp;amp; mid(InsertLineBreaks,7);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;$(InsertLineBreaks(MyText,74)) as MyFormattedText&lt;/P&gt;&lt;P&gt;Although it works fine for my case, it doesn't seem like an elegant solution. I had been using a Visual Basic function to do the same job, but it caused us problems in SR4, so I want a script replacement.&lt;/P&gt;&lt;P&gt;Any ideas on a better solution?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 May 2010 19:31:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236844#M87973</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-05-10T19:31:09Z</dc:date>
    </item>
    <item>
      <title>Inserting Line Breaks</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236845#M87974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the attached for an idea.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;data:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;data&lt;BR /&gt;1234567890ABCDEFGHIJKLMNOP&lt;BR /&gt;A long line the goes on and on&lt;BR /&gt;]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;SET crlf = 'chr(10) &amp;amp; chr(13)';&lt;BR /&gt;SET size = 7; // Break every seven chars&lt;/P&gt;&lt;P&gt;segments:&lt;BR /&gt;LOAD&lt;BR /&gt; recno() as recno,&lt;BR /&gt; iterno() as segkey,&lt;BR /&gt; mid(data, ((iterno()-1) * $(size))+1, $(size) ) as segment&lt;BR /&gt;RESIDENT data&lt;BR /&gt;WHILE iterno() * $(size) &amp;lt; len(data)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;final:&lt;BR /&gt;LOAD concat(segment, $(crlf), segkey) as finaldata&lt;BR /&gt;RESIDENT segments&lt;BR /&gt;GROUP BY recno&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;DROP TABLE data;&lt;BR /&gt;DROP TABLE segments;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 05:50:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236845#M87974</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-05-11T05:50:06Z</dc:date>
    </item>
    <item>
      <title>Inserting Line Breaks</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236846#M87975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I dont have access to QV at the moment, but how about something like:&lt;/P&gt;&lt;P&gt;Load keyfield,&lt;/P&gt;&lt;P&gt;concat(subtext, '&amp;amp;chr(39)&amp;amp;chr(10)&amp;amp;chr(13)&amp;amp;chr(39)') as newtext&lt;/P&gt;&lt;P&gt;group by keyfield;&lt;/P&gt;&lt;P&gt;Load keyfield,&lt;/P&gt;&lt;P&gt;mid(textfield, (74 * (iterno() -1)) +1, 74 * iterno()) as subtext&lt;/P&gt;&lt;P&gt;while iterno() &amp;lt;= lines;&lt;/P&gt;&lt;P&gt;Load keyfield,&lt;/P&gt;&lt;P&gt;textfield,&lt;/P&gt;&lt;P&gt;ceil(len(textfield)/74, 1) as lines&lt;/P&gt;&lt;P&gt;from.....;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 10:50:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236846#M87975</guid>
      <dc:creator />
      <dc:date>2010-05-11T10:50:34Z</dc:date>
    </item>
    <item>
      <title>Inserting Line Breaks</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236847#M87976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Heh. When I started adapting both approaches to my example, it became clear that they're actually the same approach, at least when you strip them down to fundamentals. And I agree that this is a better solution than the one I'm using. And in particular, that you both suggested the "same" solution makes me pretty confident in it.&lt;/P&gt;&lt;P&gt;Unforunately, although these scripts behave themselves in 9.0, they get a General Script Error in version 8.5. I tracked this to the combination of concat() with characters chr(10) or chr(13). It refuses to do that in 8.5. I'm guessing it's a QlikView bug that got fixed in 9.0.&lt;/P&gt;&lt;P&gt;I suppose it's no big deal. I have a working emergency fix, and once we upgrade to 9.0, I can replace it with the more elegant approach that you both came up with. Thanks, guys. &lt;IMG alt="Yes" src="http://community.qlik.com/emoticons/emotion-21.gif" /&gt;&lt;/P&gt;&lt;P&gt;Edit: Perhaps I should clarify something. Our server is on version 9.0 SR4, but our individual computers are still on 8.5. So the script must work in both 8.5 and 9.0 for the moment.&lt;/P&gt;&lt;P&gt;Edit: The "Rob &amp;amp; Gordon" solution runs an order of magnitude faster than mine.&lt;/P&gt;&lt;P&gt;Edit: Ah, the solution for 8.5 is simple. Just a single quote, new line, and another single quote. THAT works, since it seems to be the chr() that concat() has a problem with, as opposed to the new line itself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 18:37:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236847#M87976</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-05-11T18:37:57Z</dc:date>
    </item>
    <item>
      <title>Inserting Line Breaks</title>
      <link>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236848#M87977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, here's what I ended up with in context in the actual application. Seems to work. Again, thanks for your help guys.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;SET Verbatim=1;&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;LEFT JOIN ([Cost Field])&lt;BR /&gt;LOAD&lt;BR /&gt; LPID as "Cost Field Rule ID"&lt;BR /&gt;,concat(Line,'&lt;BR /&gt;',Sequence) as "Cost Field Rule"&lt;BR /&gt;GROUP BY LPID&lt;BR /&gt;;&lt;BR /&gt;LOAD&lt;BR /&gt; LPID&lt;BR /&gt;,iterno() as Sequence&lt;BR /&gt;,rtrim(mid(LPRULE,74*(iterno()-1)+1,74)) as Line&lt;BR /&gt;WHILE iterno() &amp;lt;= ceil(len(rtrim(LPRULE))/74)&lt;BR /&gt;;&lt;BR /&gt;SQL&lt;BR /&gt;SELECT LPID, LPRULE&lt;BR /&gt; FROM SYSTLC.$(TransformChar)TLP202R&lt;BR /&gt; WHERE LPREV = 9999&lt;BR /&gt; AND LPRTYP = 'C'&lt;BR /&gt; ORDER BY LPID,LPREV,LPRTYP,LPRSEQ&lt;BR /&gt;;&lt;BR /&gt;SET Verbatim=0;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 May 2010 22:53:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Inserting-Line-Breaks/m-p/236848#M87977</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-05-11T22:53:27Z</dc:date>
    </item>
  </channel>
</rss>

