<?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 Help importing ASCII file with returns in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204737#M712662</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Python script does just that: reading a file without linebreaks, and producing one with linebreaks&lt;/P&gt;&lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Nov 2010 10:40:53 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-11-30T10:40:53Z</dc:date>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204729#M712653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to import an ASCII file from an old database, where I have data that should be on the same line separated in two or more lines with returns, somtehing like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field1|field2|field3&lt;/P&gt;&lt;P&gt;right|right|right&lt;/P&gt;&lt;P&gt;right|&lt;/P&gt;&lt;P&gt;wrong|wrong&lt;/P&gt;&lt;P&gt;right|right|right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when I import the data using "|" as the separator I get some problems, in this case I would have 4 lines instead of the real 3, just because the second line got separet in two lines, with the fields divided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you think of a way to solve the problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Nov 2010 12:32:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204729#M712653</guid>
      <dc:creator />
      <dc:date>2010-11-29T12:32:14Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204730#M712654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is the extra line feed always after the record separator ? If yes, look for command line tool sed (there is Windows version available) . Replace the regular expression at the end of the line "|CRLF$" with "|" -&amp;gt; that will merge the lines.&lt;/P&gt;&lt;P&gt;Something like&lt;/P&gt;&lt;P style="font-weight: bold; padding-left: 30px"&gt;sed "/|\n$/|/" file.txt &amp;gt; fixed.txt&lt;/P&gt;&lt;P&gt;If the extra line feeds can be in random places, you need more sofisticated algorithm. Ex a Pyton / Perl script that reads one line, counts the separator characters. If those are not enough, concatenate with next line.&lt;/P&gt;&lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Nov 2010 14:24:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204730#M712654</guid>
      <dc:creator />
      <dc:date>2010-11-29T14:24:28Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204731#M712656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;Actually I was trying to do this when I run the script on import, because it will happen to several files and I didn't want to create a new version of the file. And yes, the extra line feeds can be in random places...&lt;/P&gt;&lt;P&gt;I already tried to purge and replace the chars on the load script, but I haven't managed to solve the problem. I guess the only way is to read the file creating a "purged" resident file that will later be imported as a new file without the CR and LF, dropping the first.&lt;/P&gt;&lt;P&gt;If I can't find a similar solution I will have to choose a solution like the one you are proposing, which seems to solve my problem directly on the file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Nov 2010 18:44:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204731#M712656</guid>
      <dc:creator />
      <dc:date>2010-11-29T18:44:45Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204732#M712657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can use sed to drop all CR (or CRLF) . Than have a Perl / Python script that reads exactly as many delimiters as there should be fields, insert a CRLF, write to fixed.txt, and repeat until EOF.&lt;/P&gt;&lt;P&gt;I am not sure you can do this with QlikView script. It does not handle well output to text files, nor reading N fields instead of complete line.&lt;/P&gt;&lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 07:50:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204732#M712657</guid>
      <dc:creator />
      <dc:date>2010-11-30T07:50:32Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204733#M712658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You may use as well something like the following in your load script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LOAD Replace(F1, chr(10), '|') AS F1FROM File;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Depending on the charmap you may need to add the chr(13) char too.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 08:32:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204733#M712658</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-11-30T08:32:33Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204734#M712659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;QlikView is very good at reading at line level, but will got confused by line breaks in this case.&lt;/P&gt;&lt;P&gt;----------------------------------------------------------&lt;/P&gt;&lt;P&gt;Command line bellow will remove all CR LF characters:&lt;/P&gt;&lt;P style="font-weight: bold"&gt;tr -s "\r\n" "|" &amp;lt; bad.txt &amp;gt; temp.txt&lt;/P&gt;&lt;P&gt;This results in&lt;/P&gt;&lt;P style="font-weight: bold"&gt;field1|field2|field3|right|right|right|right|wrong|wrong|right|right|right&lt;/P&gt;&lt;P&gt;Couldn't find one-liner to replace every 3rd separator with separator and CRLF . So try a Python script that produces 4 column of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;&lt;BR /&gt;FNAME = 'temp.txt'&lt;BR /&gt;NR_FIELDS = 3&lt;BR /&gt;&lt;BR /&gt;with open(FNAME) as f:&lt;BR /&gt; raw = f.readlines()[0].split('|')&lt;BR /&gt; res = []&lt;BR /&gt; for i in xrange(len(raw)):&lt;BR /&gt; if (i % NR_FIELDS == 0):&lt;BR /&gt; res.append('\n' + raw&lt;IMG alt="Idea" src="http://community.qlik.com/emoticons/emotion-55.gif" /&gt;)&lt;BR /&gt; else:&lt;BR /&gt; res.append(raw&lt;IMG alt="Idea" src="http://community.qlik.com/emoticons/emotion-55.gif" /&gt;)&lt;BR /&gt;&lt;BR /&gt; print '|'.join(res)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 09:29:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204734#M712659</guid>
      <dc:creator />
      <dc:date>2010-11-30T09:29:54Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204735#M712660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace the lightbulb with characters [ i ] . Too bad that text between [ c o d e] .. [ / c o d e ] still gets messed up&lt;/P&gt;&lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 09:32:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204735#M712660</guid>
      <dc:creator />
      <dc:date>2010-11-30T09:32:55Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204736#M712661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Miguel,&lt;/P&gt;&lt;P&gt;I already tried several solutions with purgechar and replace. They don't work because I'm importing the file and when you do that, from what I understood, qv script just reads the separators for the fields, creating the structure of the table, and then it replaces the chars inside the fields created. I also thought on breaking the fields on two temp tables and then joining them, but that isn't either a great solution, because I don't have a 'clean' keyfield to do this (because of the separators and artificial lines).&lt;/P&gt;&lt;P&gt;Also removing all CR and LF, like Alex also tried, creates a single structure that is hard to break after, creating all the single lines with the correct structure.&lt;/P&gt;&lt;P&gt;I'll keep trying when I have some time available, for now I think I'll just have to change the original files.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Joaquim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 10:37:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204736#M712661</guid>
      <dc:creator />
      <dc:date>2010-11-30T10:37:33Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204737#M712662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Python script does just that: reading a file without linebreaks, and producing one with linebreaks&lt;/P&gt;&lt;P&gt;-Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 10:40:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204737#M712662</guid>
      <dc:creator />
      <dc:date>2010-11-30T10:40:53Z</dc:date>
    </item>
    <item>
      <title>Help importing ASCII file with returns</title>
      <link>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204738#M712663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;Yeah, I guess I'll have to use something like this on the original file. Like I was telling Miguel I hope to find a solution later to do this directly on qv which will save me some time and make a clear structure to when we have to treat info this way. Counting the 'pipes' seems to be the right way (and then breaking the lines).&lt;/P&gt;&lt;P&gt;Thank you, you were really helpful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joaquim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Nov 2010 10:44:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-importing-ASCII-file-with-returns/m-p/204738#M712663</guid>
      <dc:creator />
      <dc:date>2010-11-30T10:44:33Z</dc:date>
    </item>
  </channel>
</rss>

