<?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 How to encapsulate complex expressions in to variable? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164260#M37026</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have few complex expressions in my document. I wanted to assign this expression calculation to variable or like a UDF?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers - DV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Mar 2011 12:44:30 GMT</pubDate>
    <dc:creator>IAMDV</dc:creator>
    <dc:date>2011-03-16T12:44:30Z</dc:date>
    <item>
      <title>How to encapsulate complex expressions in to variable?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164260#M37026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have few complex expressions in my document. I wanted to assign this expression calculation to variable or like a UDF?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers - DV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Mar 2011 12:44:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164260#M37026</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-03-16T12:44:30Z</dc:date>
    </item>
    <item>
      <title>SV:How to encapsulate complex expressions in to variable?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164261#M37027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To encapsulate expressions in a variable simply do like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Set eValue = 'if(vFlag = 1, Value1, Value2)';&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use previousy defined variables inside variables, like this for instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Let CurrentMonth = Left(PurgeChar(vToDay,'-'),6);&lt;BR /&gt;Let SelectedCurrentMonth = CurrentMonth;&lt;BR /&gt;Let PrevMonth = Left(PurgeChar(AddMonths(vToDay,-1),'-'),6);&lt;BR /&gt;Set ExclDateSelectsAll = 'Year=, Date=, YearQtr=, WeekYear=, Month=, Quarter=, Week=, WeekDay=, Day=';&lt;BR /&gt;Set eValue = 'if(vFlag = 1, Value1, Value2)';&lt;BR /&gt;Set eInvoiced = 'if(SelectedCurrentMonth=CurrentMonth,&lt;BR /&gt; Sum({$&amp;lt;YearMonth={"$(CurrentMonth)"}, $(ExclDateSelectsAll)&amp;gt;} $(eValue)),&lt;BR /&gt; Sum({$&amp;lt;YearMonth={"$(PrevMonth)"}, $(ExclDateSelectsAll)&amp;gt;} $(eValue)))';&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;When you want to access the values of these expressions you need to use dollar-sign expansion, like this: $(eInvoiced)&lt;/P&gt;&lt;P&gt;Also note that when using a variable inside the definition of another variable you should also use dollar-sign expansion, like in my examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 08:55:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164261#M37027</guid>
      <dc:creator>gandalfgray</dc:creator>
      <dc:date>2011-03-18T08:55:56Z</dc:date>
    </item>
    <item>
      <title>SV:How to encapsulate complex expressions in to variable?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164262#M37028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick question - Where am I declaring these variables? I mean is it under - Edit Module or Variable Overiew window?&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;Cheers - DV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 09:39:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164262#M37028</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-03-18T09:39:14Z</dc:date>
    </item>
    <item>
      <title>SV:Re: SV:How to encapsulate complex expressions in to variable?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164263#M37029</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 do it in Edit &lt;B&gt;Script&lt;/B&gt; (Ctrl-E) &lt;B&gt;&lt;/B&gt; (that is: in the load script)&lt;B&gt;&lt;BR /&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;(maybe in variable overview, but not in Edit Module anyway)&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Smile" src="http://community.qlik.com/emoticons/emotion-1.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 09:53:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-encapsulate-complex-expressions-in-to-variable/m-p/164263#M37029</guid>
      <dc:creator>gandalfgray</dc:creator>
      <dc:date>2011-03-18T09:53:14Z</dc:date>
    </item>
  </channel>
</rss>

