<?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 can set a variable with a query value? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676227#M245422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this will load 1 record into the MaxTable. The record will include the maximum value of E from the consulta table. Then it will assign that one (max) value to a variable called vMax using the peek() function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;MaxTable:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;load max(E) as MaxValue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;resident consulta;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;let vMax = peek(&lt;/SPAN&gt;&lt;SPAN class="Code" style="font-size: 10pt; line-height: 1.5em; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;'MaxValue', 0, 'MaxTable' )&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Sep 2014 23:05:32 GMT</pubDate>
    <dc:creator>JonnyPoole</dc:creator>
    <dc:date>2014-09-23T23:05:32Z</dc:date>
    <item>
      <title>how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676223#M245418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi dear Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need set a variable with a query value, some thing like set Var=(load max(E) from resident consulta);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any body could help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 18:48:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676223#M245418</guid>
      <dc:creator />
      <dc:date>2014-09-23T18:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676224#M245419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let Var = peek('E', -1, 'consulta')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and make sure you have ordered consulta table by field E (asc) before variable initialization&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 18:53:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676224#M245419</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-23T18:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676225#M245420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;consulta:&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;year&amp;nbsp; ,&amp;nbsp;&amp;nbsp; tipology&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/P&gt;&lt;P&gt;2013&amp;nbsp; ,&amp;nbsp;&amp;nbsp; rmcost&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7000&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp; rmcost/sales&lt;/P&gt;&lt;P&gt;2013&amp;nbsp; ,&amp;nbsp;&amp;nbsp; pcost&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2000 ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcost/sales&lt;/P&gt;&lt;P&gt;2013&amp;nbsp; ,&amp;nbsp;&amp;nbsp; margin&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp; margin/sales&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set var = &lt;/P&gt;&lt;P&gt;'test: &lt;/P&gt;&lt;P&gt;noconcatenate &lt;/P&gt;&lt;P&gt;load * &lt;/P&gt;&lt;P&gt;resident consulta &lt;/P&gt;&lt;P&gt;where year = 2013;&lt;/P&gt;&lt;P&gt;drop table consulta;&lt;/P&gt;&lt;P&gt;';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(var)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 19:26:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676225#M245420</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-09-23T19:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676226#M245421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Konstantins ,&lt;/P&gt;&lt;P&gt;Thanks Massimo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for example if my field is monetary and I cant ordered by him ?&lt;/P&gt;&lt;P&gt;I need&amp;nbsp; for example a count or max?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 22:47:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676226#M245421</guid>
      <dc:creator />
      <dc:date>2014-09-23T22:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676227#M245422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this will load 1 record into the MaxTable. The record will include the maximum value of E from the consulta table. Then it will assign that one (max) value to a variable called vMax using the peek() function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;MaxTable:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;load max(E) as MaxValue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;resident consulta;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;let vMax = peek(&lt;/SPAN&gt;&lt;SPAN class="Code" style="font-size: 10pt; line-height: 1.5em; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;'MaxValue', 0, 'MaxTable' )&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 23:05:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676227#M245422</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-09-23T23:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676228#M245423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you need the max or min or count of a field in a variable copy Jonathan's script and replace max with your aggregation (min, count, ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when you use a resident load (as in Jonathan script) you can add an order by&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 07:59:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676228#M245423</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-09-24T07:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676229#M245424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Experts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:52:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/676229#M245424</guid>
      <dc:creator />
      <dc:date>2014-09-24T14:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: how can set a variable with a query value?</title>
      <link>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/1967641#M1220413</link>
      <description>&lt;P&gt;Thank you very much, I spent almost 2 hours on this. Tried different ways mentioned on forum but my variable was getting NULL value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 10:10:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-can-set-a-variable-with-a-query-value/m-p/1967641#M1220413</guid>
      <dc:creator>Shrikant</dc:creator>
      <dc:date>2022-08-11T10:10:51Z</dc:date>
    </item>
  </channel>
</rss>

