<?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 set a variable within the load statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/set-a-variable-within-the-load-statement/m-p/193800#M54931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;The short answer is that you cannot set variable values within a LOAD statement. You can, however, interrogate the loaded data after loading and set a variable based on the outcome. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;MyTable:&lt;BR /&gt;&lt;BR /&gt;LOAD models,&lt;BR /&gt; productColor,&lt;BR /&gt; price,&lt;BR /&gt; quantity&lt;BR /&gt;&lt;BR /&gt;FROM&lt;BR /&gt;items.csv (txt, codepage is 1252, embedded labels, delimiter is ';', msq);&lt;BR /&gt;&lt;BR /&gt;tmp:&lt;BR /&gt;LOAD Count(productColor) As WhiteCount&lt;BR /&gt;Resident MyTable;&lt;BR /&gt;&lt;BR /&gt;Let productcode = (If(Peek('WhiteCount') &amp;gt; 0, '7231', ''));&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Drop Table tmp;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Jan 2011 11:37:38 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2011-01-31T11:37:38Z</dc:date>
    <item>
      <title>set a variable within the load statement</title>
      <link>https://community.qlik.com/t5/QlikView/set-a-variable-within-the-load-statement/m-p/193799#M54930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear QV community&lt;BR /&gt;&lt;BR /&gt; unfortunately I can not find suitable solution for my problem in the forum.&lt;BR /&gt;How can I set variables in the load block ? Thank you!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here a pseudocode of my intension !&lt;/P&gt;&lt;P&gt;&amp;lt;qlikview script&amp;gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;MyTable:&lt;/P&gt;&lt;P style="font-weight: bold"&gt;LOAD models,&lt;BR /&gt; if( product= 'white', productcode = '7231', productcode='7000' ) as productColor,&lt;BR /&gt; price,&lt;BR /&gt; quantity&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;FROM&lt;BR /&gt;items.csv (txt, codepage is 1252, embedded labels, delimiter is ';', msq);&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/qlikview script&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 11:25:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-a-variable-within-the-load-statement/m-p/193799#M54930</guid>
      <dc:creator />
      <dc:date>2011-01-31T11:25:39Z</dc:date>
    </item>
    <item>
      <title>set a variable within the load statement</title>
      <link>https://community.qlik.com/t5/QlikView/set-a-variable-within-the-load-statement/m-p/193800#M54931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;The short answer is that you cannot set variable values within a LOAD statement. You can, however, interrogate the loaded data after loading and set a variable based on the outcome. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;MyTable:&lt;BR /&gt;&lt;BR /&gt;LOAD models,&lt;BR /&gt; productColor,&lt;BR /&gt; price,&lt;BR /&gt; quantity&lt;BR /&gt;&lt;BR /&gt;FROM&lt;BR /&gt;items.csv (txt, codepage is 1252, embedded labels, delimiter is ';', msq);&lt;BR /&gt;&lt;BR /&gt;tmp:&lt;BR /&gt;LOAD Count(productColor) As WhiteCount&lt;BR /&gt;Resident MyTable;&lt;BR /&gt;&lt;BR /&gt;Let productcode = (If(Peek('WhiteCount') &amp;gt; 0, '7231', ''));&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Drop Table tmp;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 11:37:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-a-variable-within-the-load-statement/m-p/193800#M54931</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2011-01-31T11:37:38Z</dc:date>
    </item>
  </channel>
</rss>

