<?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 Re: How to read from a parameter file having multilines. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563562#M210307</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you have to loop on your QV table&amp;nbsp; (in my example parameter.txt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AAA:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp; @1 as pos_name,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Right(@1, Len(@1)-6 ) as field&lt;/P&gt;&lt;P&gt;FROM parameter.txt&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, no labels, delimiter is '\t', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET rows=NoOfRows('AAA');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i=0 to $(rows)-1&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt; LET filter=peek('field', $(i));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; trace $(i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; trace $(filter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLE:&lt;/P&gt;&lt;P&gt;&amp;nbsp; SQL&lt;/P&gt;&lt;P&gt;&amp;nbsp; select POS_Name, POS_Location&lt;/P&gt;&lt;P&gt;&amp;nbsp; from &lt;/P&gt;&lt;P&gt;&amp;nbsp; test.pos_history&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; where pos_id in ('$(filter)');&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ////Need your help here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Mar 2014 11:43:32 GMT</pubDate>
    <dc:creator>maxgro</dc:creator>
    <dc:date>2014-03-12T11:43:32Z</dc:date>
    <item>
      <title>How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563555#M210300</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 would like to accomplish the following scenario in QV. &lt;BR /&gt;I have a parameter file: parameter.txt. In this file, I have lines:&lt;BR /&gt;POS_1='AXP','ORB','CTIX','PTM','RQST','PLQL','MAR','CTP','FRN','TVE','MTE','JTGA','MOT' &lt;/P&gt;&lt;P&gt;POS_2='HCL','HCRG','CAN','ESR','HAA','EBCH','EBDE'&lt;/P&gt;&lt;P&gt;POS_3='MJDK','MJSE','NATW','COUT','EBAT','EBBE' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I need to read the values assigned to each of the POS_* in my QV script and use them in a Query. For example:&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;Temp_Table:&lt;BR /&gt;select POS_Name, POS_Location&lt;BR /&gt;from &lt;BR /&gt;test.pos_history&lt;BR /&gt;where pos_id in (Read value of POS_1 from parameter.txt)&amp;nbsp;&amp;nbsp;&amp;nbsp; ////Need your help here &lt;/P&gt;&lt;P&gt;concatenate&lt;BR /&gt;select&lt;/P&gt;&lt;P&gt;POS_Name, POS_Location&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;test.pos_history&lt;/P&gt;&lt;P&gt;where pos_id in (Read value of POS_2 from parameter.txt)&amp;nbsp;&amp;nbsp;&amp;nbsp; ////Need your help here &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;--------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 07:36:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563555#M210300</guid>
      <dc:creator />
      <dc:date>2014-03-12T07:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563556#M210301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is your code for a single file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AAA:&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;pos_name&lt;/P&gt;&lt;P&gt;"POS_1='AXP','ORB','CTIX','PTM','RQST','PLQL','MAR','CTP','FRN','TVE','MTE','JTGA','MOT'"&lt;/P&gt;&lt;P&gt;"POS_2='HCL','HCRG','CAN','ESR','HAA','EBCH','EBDE'"&lt;/P&gt;&lt;P&gt;"POS_3='MJDK','MJSE','NATW','COUT','EBAT','EBBE'"&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BBB:&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD Subfield(Mid(pos_name, Index(pos_name,'=')+1),',') as str Resident AAA;&lt;/P&gt;&lt;P&gt;DROP Table AAA;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 07:46:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563556#M210301</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-03-12T07:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563557#M210302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it seems, I should not use Inline Table in my script. The reason for this is not to touch the code in future, whenever I need to add/delete a POS id. Only place to change is the parameter file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second point of using Concatenate in my script is, data for each POS is so huge that if I keep all of them together, it results in DB time out error. Hence, I decided to divide it multiple SQL and merge them using Concatenate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 08:04:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563557#M210302</guid>
      <dc:creator />
      <dc:date>2014-03-12T08:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563558#M210303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the inline only to load data for my example, you may load data from other sources obviously ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use the code I send you, and fix it for your file, then you have only to replicate it and concatenate each other&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 08:30:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563558#M210303</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-03-12T08:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563559#M210304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see attachment&lt;/P&gt;&lt;P&gt;I started from Alessandro script (tkanks)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameter.txt is your file&lt;/P&gt;&lt;P&gt;pos.txt is a test file (replace it with pos_history)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SCRIPT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Directory;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AAA:&lt;/P&gt;&lt;P&gt;LOAD @1 as pos_name&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;parameter.txt&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, no labels, delimiter is '\t', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BBB:&lt;/P&gt;&lt;P&gt;load pos, replace(str, chr(39), '') as str;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;mid(pos_name,1,5) as pos,&lt;/P&gt;&lt;P&gt;Subfield(Mid(pos_name, Index(pos_name,'=')+1),',') as str Resident AAA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table AAA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CCC:&lt;/P&gt;&lt;P&gt;left keep (BBB)&lt;/P&gt;&lt;P&gt;LOAD @1 as pos, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @2 as str&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;pos.txt&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, no labels, delimiter is ',', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table BBB;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 08:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563559#M210304</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-03-12T08:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563560#M210305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got your point. I tried doing that, but stuck at the second point of my question (if you see my question above...there is a place which I commented 'I need your help here').&lt;BR /&gt;At that point, how would I be able to call a QV table inside a SQL query? Means, How could I write something as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp_Table:&lt;/P&gt;&lt;P&gt;select POS_Name, POS_Location&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;test.pos_history&lt;/P&gt;&lt;P&gt;where pos_id in (&lt;STRONG&gt;&lt;EM&gt;Load&lt;/EM&gt;&lt;EM&gt; str from BBB&lt;/EM&gt;&lt;/STRONG&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp; /// showing error here&lt;/P&gt;&lt;P&gt;////Need your help here: As AAA is a QV table while pos_history is my DB table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 11:09:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563560#M210305</guid>
      <dc:creator />
      <dc:date>2014-03-12T11:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563561#M210306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Massimo. Thanks for your inputs. But I find myself stuck at a point as how I could use the final values in the SQL statement...means:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp_Table:&lt;/P&gt;&lt;P&gt;select POS_Name, POS_Location&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;test.pos_history&lt;/P&gt;&lt;P&gt;where pos_id in (&lt;STRONG&gt;&lt;EM&gt;Load str from CCC &lt;/EM&gt;&lt;/STRONG&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp; /// showing error here&lt;/P&gt;&lt;P&gt;////Need your help here: As CCCis a QV table while pos_history is my DB table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 11:13:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563561#M210306</guid>
      <dc:creator />
      <dc:date>2014-03-12T11:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563562#M210307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you have to loop on your QV table&amp;nbsp; (in my example parameter.txt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AAA:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp; @1 as pos_name,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Right(@1, Len(@1)-6 ) as field&lt;/P&gt;&lt;P&gt;FROM parameter.txt&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, no labels, delimiter is '\t', msq);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET rows=NoOfRows('AAA');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i=0 to $(rows)-1&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt; LET filter=peek('field', $(i));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; trace $(i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; trace $(filter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLE:&lt;/P&gt;&lt;P&gt;&amp;nbsp; SQL&lt;/P&gt;&lt;P&gt;&amp;nbsp; select POS_Name, POS_Location&lt;/P&gt;&lt;P&gt;&amp;nbsp; from &lt;/P&gt;&lt;P&gt;&amp;nbsp; test.pos_history&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; where pos_id in ('$(filter)');&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ////Need your help here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 11:43:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563562#M210307</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-03-12T11:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from a parameter file having multilines.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563563#M210308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 10:57:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-read-from-a-parameter-file-having-multilines/m-p/563563#M210308</guid>
      <dc:creator />
      <dc:date>2014-03-18T10:57:41Z</dc:date>
    </item>
  </channel>
</rss>

