<?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 with Importing Text File With Mulitple Delimiters in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149696#M716739</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll need to remember that one. &lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jul 2009 23:16:31 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2009-07-21T23:16:31Z</dc:date>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149687#M716730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;Newbie trying to transform a text file that looks like the following:&lt;/P&gt;&lt;P&gt;Request: Login | Date: 200812160750 | Elapsed Time: 367 | User Identifier: 4709&lt;BR /&gt;Request: Profile Search | Date: 200812160905 | Elapsed Time: 969 | User Identifier: Mann123&lt;BR /&gt;Request: View Profile | Date: 200812160905 | Elapsed Time: 54 | User Identifier: 145992&lt;/P&gt;&lt;P&gt;There's essentially two delimiters. The ":" colon and the "|" pipe.&lt;/P&gt;&lt;P&gt;My script looks like this for the &lt;STRONG&gt;*FIRST*&lt;/STRONG&gt; delimiter ":".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;LOAD&lt;BR /&gt;@1,&lt;BR /&gt; @2,&lt;BR /&gt; @3,&lt;BR /&gt; @4,&lt;BR /&gt; @5&lt;BR /&gt;FROM&lt;BR /&gt;&lt;C&gt;&lt;BR /&gt;(txt, utf8, explicit labels, delimiter is ':', no quotes);&lt;/C&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;BR /&gt;How do I transfer the second delimiter "|" pipe ?&lt;/P&gt;&lt;P&gt;Thank-you in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 03:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149687#M716730</guid>
      <dc:creator />
      <dc:date>2009-07-18T03:43:26Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149688#M716731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would this work for you?&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt; recno() as RecordNumber,&lt;BR /&gt; subfield(@1, ':',1) as v1, subfield(@1, ':',2) as v1Val,&lt;BR /&gt; subfield(@2, ':',1) as v2, subfield(@2, ':',2) as v2Val,&lt;BR /&gt; subfield(@3, ':',1) as v3, subfield(@3, ':',2) as v3Val,&lt;BR /&gt; subfield(@4, ':',1) as v4, subfield(@4, ':',2) as v4Val,&lt;BR /&gt; subfield(@5, ':',1) as v5, subfield(@5, ':',2) as v5Val&lt;BR /&gt;FROM&lt;BR /&gt;&lt;C&gt;&lt;BR /&gt;(txt, utf8, explicit labels, delimiter is '|', no quotes);&lt;/C&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 04:08:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149688#M716731</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2009-07-18T04:08:57Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149689#M716732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank-you - your script suggestion worked!&lt;/P&gt;&lt;P&gt;That did the trick. I now have data in this tool to play with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 05:40:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149689#M716732</guid>
      <dc:creator />
      <dc:date>2009-07-18T05:40:58Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149690#M716733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or if the fields are always in the same order, and including a little formatting, I'm guessing this would work and give you more meaningful field names rather than legend/value pairs:&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt; subfield(@1,': ',2) as "Request"&lt;BR /&gt;,date(date#(left (subfield(@2,': ',2),8),'YYYYMMDD'),'MM/DD/YY') as "Date"&lt;BR /&gt;,time(time#(right(subfield(@2,': ',2),4),'hhmm'),'hh:mm') as "Time"&lt;BR /&gt;,interval(subfield(@3,': ',2)/100,'hh:mm:ss.ff'), as "Elapsed time"&lt;BR /&gt;,text(subfield(@4,': ',2)) as "User Identifier"&lt;BR /&gt;FROM &lt;C&gt; (txt, utf8, explicit labels, delimiter is '|', no quotes);&lt;/C&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 06:23:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149690#M716733</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-07-18T06:23:11Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149691#M716734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your timing is impeccable.&lt;/P&gt;&lt;P&gt;I was actually going to start tackling the wacky date/time format and was just about to post a question on that. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I was originally using an open source log analysis tool called Splunk (&lt;A href="http://www.splunk.com"&gt;http://www.splunk.com&lt;/A&gt;) - I had to do some regular expressions to parse the log file - but I found the reporting feature to be quite weak.&lt;/P&gt;&lt;P&gt;I think the QlikView tool will allow me to monitor, report and possibly trigger email alerts.&lt;/P&gt;&lt;P&gt;Thank-you again! I'll let you know how your script suggestion works out...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 06:48:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149691#M716734</guid>
      <dc:creator />
      <dc:date>2009-07-18T06:48:54Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149692#M716735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;I got the following error with your script suggestion:&lt;/P&gt;&lt;P&gt;Syntax error, missing/misplaced FROM:&lt;BR /&gt;LOAD&lt;BR /&gt;subfield(@1,': ',2) as "Request",&lt;BR /&gt;date(date#(left (subfield(@2,': ',2),8),'YYYYMMDD'),'MM/DD/YY') as "Date",&lt;BR /&gt;time(time#(right(subfield(@2,': ',2),4),'hhmm'),'hh:mm') as "Time",&lt;BR /&gt;interval(subfield(@3,': ',2)/100,'hh:mm:ss.ff'), as "Elapsed time",&lt;BR /&gt;text(subfield(@4,': ',2)) as "User Identifier"&lt;BR /&gt;FROM&lt;BR /&gt;&lt;C&gt; (txt, utf8, explicit labels, delimiter is '|', no quotes)&lt;BR /&gt;LOAD&lt;BR /&gt;subfield(@1,': ',2) as "Request",&lt;BR /&gt;date(date#(left (subfield(@2,': ',2),8),'YYYYMMDD'),'MM/DD/YY') as "Date",&lt;BR /&gt;time(time#(right(subfield(@2,': ',2),4),'hhmm'),'hh:mm') as "Time",&lt;BR /&gt;interval(subfield(@3,': ',2)/100,'hh:mm:ss.ff'), as "Elapsed time",&lt;BR /&gt;text(subfield(@4,': ',2)) as "User Identifier"&lt;BR /&gt;FROM&lt;BR /&gt;&lt;C&gt; (txt, utf8, explicit labels, delimiter is '|', no quotes)&lt;/C&gt;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 07:03:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149692#M716735</guid>
      <dc:creator />
      <dc:date>2009-07-18T07:03:00Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149693#M716736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I probably missed a comma, or have misbalanced parentheses or something. QlikView isn't very good at telling you the real problem, I've found. "Missing/Misplaced FROM", more often than not, means "syntax error in your list of fields".&lt;/P&gt;&lt;P&gt;Ah, looks like I put an EXTRA comma after the last parenthesis in the Elapsed Time line. Remove that comma, or just copy the below.&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt; subfield(@1,': ',2) as "Request"&lt;BR /&gt;,date(date#(left (subfield(@2,': ',2),8),'YYYYMMDD'),'MM/DD/YY') as "Date"&lt;BR /&gt;,time(time#(right(subfield(@2,': ',2),4),'hhmm'),'hh:mm') as "Time"&lt;BR /&gt;,interval(subfield(@3,': ',2)/(24*60*60*100),'hh:mm:ss.ff') as "Elapsed time"&lt;BR /&gt;,text(subfield(@4,': ',2)) as "User Identifier"&lt;BR /&gt;FROM &lt;C&gt; (txt, utf8, explicit labels, delimiter is '|', no quotes)&lt;BR /&gt;;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;Oh, and perhaps I should explain what this is doing. Hard to learn otherwise.&lt;/P&gt;&lt;P&gt;The subfield() function breaks a field apart into more than one field based on a delimiter, so that's how we're handling the multiple delimiters here - one in subfield, the other in the FROM. We're telling it we want the second subfield and that ': ' is our delimiter, so that should return the value portion.&lt;/P&gt;&lt;P&gt;Date#() and time#() functions build a date or time based on a particular format of the input, so that first string is the format of the input.&lt;/P&gt;&lt;P&gt;Date() and time() functions tell the system how you WANT the date and time to be formatted, so the second string is the format we want.&lt;/P&gt;&lt;P&gt;Interval() tells the system how to format an interval of time. However, now that I look at it, I messed it up. I was assuming that your numbers were hundredths of a second. But an interval is the fraction of an entire day, not of a second, so I should have divided by (24*60*60*100). Fixed.&lt;/P&gt;&lt;P&gt;I explicitly tell it that the User Identifier is text() because we've had some issues in the past with IDs like 043E07 being interpreted as scientific notation, and coming out really weird. So when I see a mixture of text and things that could be interpreted as a number, I wrap it in text() just in case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 07:14:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149693#M716736</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-07-18T07:14:14Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149694#M716737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John.&lt;/P&gt;&lt;P&gt;It works! I should have reviewed the script myself more. Thank-you.&lt;/P&gt;&lt;P&gt;My "Elasped Time" is really just milliseconds but it doesn't need to be modified at this time. I'll take a swag at updating your code this weekend to fix it up.&lt;/P&gt;&lt;P&gt;My goal this weekend is to create some visual charts/graphs (usual the app itself).&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2009 07:48:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149694#M716737</guid>
      <dc:creator />
      <dc:date>2009-07-18T07:48:26Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149695#M716738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The TextBetween function can also be very useful for this kind of parsing. I like it because it's self documenting and is not dependent on field order. Read the record without a delimiter and then you can do functions like:&lt;/P&gt;&lt;P&gt;trim(TextBetween(@1, 'Request:', '|')) as Request&lt;BR /&gt;trim(TextBetween(@1, 'Elapsed Time:', '|')) as ElapsedTIme&lt;/P&gt;&lt;P&gt;etc. You'll still need to do date/time interpretation as before.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 06:19:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149695#M716738</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-07-21T06:19:03Z</dc:date>
    </item>
    <item>
      <title>Help with Importing Text File With Mulitple Delimiters</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149696#M716739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll need to remember that one. &lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 23:16:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Importing-Text-File-With-Mulitple-Delimiters/m-p/149696#M716739</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-07-21T23:16:31Z</dc:date>
    </item>
  </channel>
</rss>

