<?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 Import a txt file in difficult format in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226871#M79036</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;jonahed79 wrote:The format of this file makes it rather difficult to import&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;No kidding &lt;IMG alt="Stick out tongue" src="http://community.qlik.com/emoticons/emotion-4.gif" /&gt;&lt;/P&gt;&lt;P&gt;I have never had to worry about something like this so thought I'd give it a go out of interest. I used the Transformation Steps in the Load wizard (again, something I've never had to do) and managed to produce the output you required. See the attached qvw.&lt;/P&gt;&lt;P&gt;But the solution is unworkable in real world as the only way it can make sense of the file is by using 'space' as the delimiter. This means that the load would just fall over unless all the fields (Vendor, Item, Buyer etc.) were strictly enforced to have no spaces or a set number of spaces in the text.&lt;/P&gt;&lt;P&gt;I am no expert when it comes to this kind of load but I imagine that handling this kind of file it just not practical. If it was me then I would output the Oracle query/report to a csv file or, better yet, get the SQL code used for the query and run it directly via ODBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Oct 2010 14:26:20 GMT</pubDate>
    <dc:creator>nathanfurby</dc:creator>
    <dc:date>2010-10-04T14:26:20Z</dc:date>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226870#M79035</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 have an Oracle report that we run daily that I want to load into Qlikview.&lt;/P&gt;&lt;P&gt;The format of this file makes it rather difficult to import. I have attached an example of the Oracle file and the resulting table I'm looking for.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The data in the resulting table need to extracted from three lines in the original file (line 1, 9, 10, 11 and 12).&lt;/LI&gt;&lt;LI&gt;Line 1 is used in both lines in the resulting table&lt;/LI&gt;&lt;LI&gt;Line 9 and 10 is used in the first line in the resulting table&lt;/LI&gt;&lt;LI&gt;Line 10 and 11 is used in the second line in the resulting table&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;It's not an option to simplify the format before exporting it from Oracle.&lt;/P&gt;&lt;P&gt;How do I write the code for this?&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Jonas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 10:38:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226870#M79035</guid>
      <dc:creator />
      <dc:date>2010-10-04T10:38:59Z</dc:date>
    </item>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226871#M79036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;jonahed79 wrote:The format of this file makes it rather difficult to import&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;No kidding &lt;IMG alt="Stick out tongue" src="http://community.qlik.com/emoticons/emotion-4.gif" /&gt;&lt;/P&gt;&lt;P&gt;I have never had to worry about something like this so thought I'd give it a go out of interest. I used the Transformation Steps in the Load wizard (again, something I've never had to do) and managed to produce the output you required. See the attached qvw.&lt;/P&gt;&lt;P&gt;But the solution is unworkable in real world as the only way it can make sense of the file is by using 'space' as the delimiter. This means that the load would just fall over unless all the fields (Vendor, Item, Buyer etc.) were strictly enforced to have no spaces or a set number of spaces in the text.&lt;/P&gt;&lt;P&gt;I am no expert when it comes to this kind of load but I imagine that handling this kind of file it just not practical. If it was me then I would output the Oracle query/report to a csv file or, better yet, get the SQL code used for the query and run it directly via ODBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 14:26:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226871#M79036</guid>
      <dc:creator>nathanfurby</dc:creator>
      <dc:date>2010-10-04T14:26:20Z</dc:date>
    </item>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226872#M79037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day Jonas,&lt;/P&gt;&lt;P&gt;you may give it a try with a code similar to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Report:&lt;BR /&gt; LOAD&lt;BR /&gt; *&lt;BR /&gt; WHERE&lt;BR /&gt; WILDMATCH(Data, '??-???-*'); // only rows containing Date&lt;BR /&gt; LOAD&lt;BR /&gt; IF(ODD(LineNo), PREVIOUS(ReportRow) &amp;amp; ReportRow) AS Data; // concatenate 2 lines&lt;BR /&gt; LOAD&lt;BR /&gt; @1:n AS ReportRow,&lt;BR /&gt; RecNo() AS LineNo&lt;BR /&gt; FROM&lt;BR /&gt; [.\Report.txt]&lt;BR /&gt; (fix, codepage is 1252);&lt;BR /&gt;&lt;BR /&gt;Vendor:&lt;BR /&gt; LOAD&lt;BR /&gt; MID(@1:n, 8, 69) AS Vendor&lt;BR /&gt; FROM&lt;BR /&gt; [.\Report.txt]&lt;BR /&gt; (fix, codepage is 1252)&lt;BR /&gt; WHERE&lt;BR /&gt; WILDMATCH(@1:n, 'Vendor:*');&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This should result in a table containing only one line per Purchase-Order in fixed format, which need to be cutted into fields (and fieldnames) etc. The other table may contain the vendor (or other site-information as in the header of the report) and can be added with JOIN to the datatable.&lt;/P&gt;&lt;P&gt;HTH&lt;BR /&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 15:20:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226872#M79037</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2010-10-04T15:20:14Z</dc:date>
    </item>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226873#M79038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nathan,&lt;/P&gt;&lt;P&gt;Thanks for your reply! I just found an alternate solution so I haven't had a chance to test yours. I used the 'peek' function to get the correct result.&lt;/P&gt;&lt;P&gt;I'll try yours soon to see if it's simpler.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Jonas&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;tmpPastDue:&lt;BR /&gt;LOAD if(@6:12='Vendor:',@14:79,peek('tmpVendor')) as tmpVendor,&lt;BR /&gt; if(@3:3='-',makedate('20' &amp;amp; num#(right(@1:9,2)),num#(applymap('Months_cap',mid(@1:9,4,3))), if(mid(@1:9,2,1)='-',num#(left(@1:9,1)),num#(left(@1:9,2)))),peek('tmpDueDate')) as tmpDueDate,&lt;BR /&gt; if(@11:34 like '*,*',@11:34,peek('tmpBuyer')) as tmpBuyer,&lt;BR /&gt; @11:32 as tmpItem&lt;BR /&gt;FROM Pastdue.txt (fix, codepage is 1252);&lt;BR /&gt;&lt;BR /&gt;PastDue:&lt;BR /&gt;LOAD tmpVendor as [Past Due Vendor],&lt;BR /&gt; tmpDueDate as [Past Due Due Date],&lt;BR /&gt; tmpBuyer as [Past Due Buyer],&lt;BR /&gt; tmpItem as [Past Due Item Number]&lt;BR /&gt;RESIDENT tmpPastDue&lt;BR /&gt;WHERE isnum(mid(tmpItem,7,2));&lt;BR /&gt;&lt;BR /&gt;drop table tmpPastDue;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 15:27:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226873#M79038</guid>
      <dc:creator />
      <dc:date>2010-10-04T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226874#M79039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonas - I doubt my solution will be any better - not very robust as I mentioned.&lt;/P&gt;&lt;P&gt;Can you attach the text file you used with the example you posted. I tried it with the first file you attached and it didn't work. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 15:36:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226874#M79039</guid>
      <dc:creator>nathanfurby</dc:creator>
      <dc:date>2010-10-04T15:36:54Z</dc:date>
    </item>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226875#M79040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about that Nathan,&lt;/P&gt;&lt;P&gt;I simplified the text file a bit last time I sent it over. I've attached a new text file and a *.qvw file so you can see the solution.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Jonas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 16:02:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226875#M79040</guid>
      <dc:creator />
      <dc:date>2010-10-04T16:02:31Z</dc:date>
    </item>
    <item>
      <title>Import a txt file in difficult format</title>
      <link>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226876#M79041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting use of the fixed record file type (I've never looked at this before) and the peek function. A few presumptions about the data that you'd have to keep an eye on - but necessary I suppose when you are dealing with such a messy data source &lt;IMG alt="Stick out tongue" src="http://community.qlik.com/emoticons/emotion-4.gif" /&gt;&lt;/P&gt;&lt;P&gt;Many thanks Jonas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Oct 2010 16:57:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-a-txt-file-in-difficult-format/m-p/226876#M79041</guid>
      <dc:creator>nathanfurby</dc:creator>
      <dc:date>2010-10-04T16:57:03Z</dc:date>
    </item>
  </channel>
</rss>

