<?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: Variable troubles in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614139#M226598</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Massimo, that seems to have done it though I didn't need the chr(39)'s. But...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why doesn't the first line evaluate the same as the second?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; '=AddMonths($(vMaxdate),-$(b))';&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;'=AddMonths(' &amp;amp;&amp;nbsp; '$' &amp;amp; '(vMaxdate)'&amp;nbsp; &amp;amp; ',-$(b))';&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to me (a .net developer) that they should be the same as the second is just concatenated pieces of text?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Mar 2014 09:35:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-03-10T09:35:04Z</dc:date>
    <item>
      <title>Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614133#M226592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alright chaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a variable...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMaxdate = '=max(MonthStart(prvMonthEnd))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a for loop I want to end up with...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMaxdate_1=AddMonths('$(vMaxdate)',-11)&lt;/P&gt;&lt;P&gt;vMaxdate_2=AddMonths('$(vMaxdate)',-10)&lt;/P&gt;&lt;P&gt;vMaxdate_3=AddMonths('$(vMaxdate)',-9) etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR a = 1 to 12&lt;/P&gt;&lt;P&gt;&amp;nbsp; LET b = 12-$(a);&lt;/P&gt;&lt;P&gt;&amp;nbsp; LET vMaxdate_$(a) = '=AddMonths(&lt;SPAN style="color: #575757;"&gt;$(vMaxdate)&lt;/SPAN&gt;,-$(b))';&lt;/P&gt;&lt;P&gt;NEXT a;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am getting the text of vMaxdate in each variable...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMaxdate_1=AddMonths(=max(MonthStart(prvMonthEnd)),-11)&lt;/P&gt;&lt;P&gt;vMaxdate_2=AddMonths(=max(MonthStart(prvMonthEnd)),-10)&lt;/P&gt;&lt;P&gt;vMaxdate_3=AddMonths(=max(MonthStart(prvMonthEnd)),-9) etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how do I force the variable name rather than its expression into the second set of variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Foldy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 12:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614133#M226592</guid>
      <dc:creator />
      <dc:date>2014-03-07T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614134#M226593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I should try this:&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;LET vMaxdate = max(MonthStart(prvMonthEnd));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FOR a = 1 to 12&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; LET b = 12-$(a);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; LET vMaxdate_$(a) = AddMonths(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #575757;"&gt;$(vMaxdate)&lt;/SPAN&gt;,-$(b));&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;NEXT a;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 12:29:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614134#M226593</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-03-07T12:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614135#M226594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks but that's not quite what I wanted. I think that will try and evaluate the AddMonths whereas I want the AddMonths as text along with the variable $(vMaxdate)... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 12:40:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614135#M226594</guid>
      <dc:creator />
      <dc:date>2014-03-07T12:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614136#M226595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi foldyman,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you might also consider using a single parameterized variable instead of the whole creating multible variables in a loop concept:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vMaxdate = '=AddMonths(max(MonthStart(prvMonthEnd)),'&amp;amp;$1&amp;amp;'-12)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which could be used like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(vMaxdate(1))&amp;nbsp; for a value of '=AddMonths(&lt;SPAN style="color: #575757;"&gt;&lt;SPAN style="color: #575757;"&gt;max(MonthStart(prvMonthEnd)&lt;/SPAN&gt;)&lt;/SPAN&gt;,-11)'&lt;/P&gt;&lt;P&gt;$(vMaxdate(2))&amp;nbsp; for a value of '=AddMonths(&lt;SPAN style="color: #575757;"&gt;&lt;SPAN style="color: #575757;"&gt;max(MonthStart(prvMonthEnd)&lt;/SPAN&gt;)&lt;/SPAN&gt;,-10)'&lt;/P&gt;&lt;P&gt;$(vMaxdate(3))&amp;nbsp;&amp;nbsp; for a value of '=AddMonths(&lt;SPAN style="color: #575757;"&gt;&lt;SPAN style="color: #575757;"&gt;max(MonthStart(prvMonthEnd)&lt;/SPAN&gt;)&lt;/SPAN&gt;,-9)'&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which then could be calculated using this syntax:&lt;/P&gt;&lt;P&gt;$(=$(vMaxdate(1)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 12:41:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614136#M226595</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2014-03-07T12:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614137#M226596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;SCRIPT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMaxdate = 'max(MonthStart(prvMonthEnd))';&lt;/P&gt;&lt;P&gt;FOR a = 1 to 12&lt;/P&gt;&lt;P&gt;&amp;nbsp; LET b = 12-$(a);&lt;/P&gt;&lt;P&gt;&amp;nbsp; LET vMaxdate_$(a) = '=AddMonths(' &amp;amp; chr(39) &amp;amp; '$' &amp;amp; '(vMaxdate)' &amp;amp; chr(39) &amp;amp; ',-$(b))';&lt;/P&gt;&lt;P&gt;NEXT a;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RESULT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="var.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/54546_var.jpg" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 21:55:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614137#M226596</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-03-07T21:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614138#M226597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marco. Never seen parameterized variables before. I tried it out on my dash but it seems in this instance that performance really suffers. I'll be keeping the idea in my code snippets bank for the future tho. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 09:29:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614138#M226597</guid>
      <dc:creator />
      <dc:date>2014-03-10T09:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614139#M226598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Massimo, that seems to have done it though I didn't need the chr(39)'s. But...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why doesn't the first line evaluate the same as the second?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; '=AddMonths($(vMaxdate),-$(b))';&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;'=AddMonths(' &amp;amp;&amp;nbsp; '$' &amp;amp; '(vMaxdate)'&amp;nbsp; &amp;amp; ',-$(b))';&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to me (a .net developer) that they should be the same as the second is just concatenated pieces of text?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 09:35:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614139#M226598</guid>
      <dc:creator />
      <dc:date>2014-03-10T09:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614140#M226599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;interesting, I never noticed any performance influence of this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Did you intentionally mark your own comment helpful?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Marco&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 22:23:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614140#M226599</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2014-03-12T22:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Variable troubles</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614141#M226600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Errr yes. obviously getting click happy in my old age. Unmarked now tho.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I was doing something wrong - I'll try it again. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 10:54:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-troubles/m-p/614141#M226600</guid>
      <dc:creator />
      <dc:date>2014-03-18T10:54:50Z</dc:date>
    </item>
  </channel>
</rss>

