<?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 LOAD, dynamic, variable to table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380660#M701730</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Trying to simulate a montly report. To do that I need to save aggregated data in a table. No problem saving vVar, but I want to save the calculated value - in this case 830.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vVar='sum({&amp;lt;region={1}&amp;gt;}sales)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sales:&lt;BR /&gt;LOAD * Inline [&lt;BR /&gt;region,sales&lt;BR /&gt;1,200&lt;BR /&gt;1,630&lt;BR /&gt;2,300];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x:&lt;BR /&gt;LOAD $(vVar) AS Value AUTOGENERATE(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Aug 2012 12:59:45 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-08-24T12:59:45Z</dc:date>
    <item>
      <title>LOAD, dynamic, variable to table</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380660#M701730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Trying to simulate a montly report. To do that I need to save aggregated data in a table. No problem saving vVar, but I want to save the calculated value - in this case 830.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vVar='sum({&amp;lt;region={1}&amp;gt;}sales)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sales:&lt;BR /&gt;LOAD * Inline [&lt;BR /&gt;region,sales&lt;BR /&gt;1,200&lt;BR /&gt;1,630&lt;BR /&gt;2,300];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x:&lt;BR /&gt;LOAD $(vVar) AS Value AUTOGENERATE(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 12:59:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380660#M701730</guid>
      <dc:creator />
      <dc:date>2012-08-24T12:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: LOAD, dynamic, variable to table</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380661#M701731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can't use set analysis in a script, you could generate aggr tables and peek the results; something like this:&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;sales:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;LOAD * Inline [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;region,sales&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;1,200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;1,630&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;2,300];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;Sales_Sum:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;NoConcatenate LOAD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt; sum(sales) as sum_sales&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;Resident sales_temp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;where region=1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;group by region;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;LET vVar=Peek('sum_sales',0,'Sales_Sum');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;x:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000080;"&gt;LOAD $(vVar) AS Value AUTOGENERATE(1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use varibles / loop / curser tables to define the field you're checking and the field you're grouping by (set) if your requirement is more complex than your example.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 14:32:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380661#M701731</guid>
      <dc:creator>richard_pearce6</dc:creator>
      <dc:date>2012-08-24T14:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: LOAD, dynamic, variable to table</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380662#M701732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, another way to do it. Less suitable if you have a lot of regions, too much (nested) if's, but it does the job here. Less SQL, more formulas. Also gives&lt;/P&gt;&lt;P&gt;you the possibilty to do any calc on the sales figures on scriptlevel and then have it available as flat records in the new inline table. Depends on your plans. Might help...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;Let c=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;Let d=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;sales:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;LOAD * Inline [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;region,sales&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;1,200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;1,630&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;2,300];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;For i=0 to NoOfRows('sales')-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let a=Peek('region', $(i), 'sales');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let b=Peek('sales', $(i), 'sales');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If $(a)=1 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let c=$(c)+$(b);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Endif&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If $(a)=2 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let d=$(d)+$(b);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Endif&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Next i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;x:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;LOAD * Inline [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt; Reg1_Tot, Reg2_Tot&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt; $(c), $(d)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Regards.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 15:32:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-dynamic-variable-to-table/m-p/380662#M701732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-24T15:32:42Z</dc:date>
    </item>
  </channel>
</rss>

