<?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: Passing functions into variable arguments in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604225#M223260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. For the simple if() in my example I can use set analysis, but I guess I was looking for a more comprehensive solution that would work for any type of function. Maybe a better example would have been:&lt;/P&gt;&lt;P&gt;if(Type=1,Num,Num*2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But then again, maybe I'm overthinking this!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 May 2014 12:59:01 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-05-07T12:59:01Z</dc:date>
    <item>
      <title>Passing functions into variable arguments</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604223#M223258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using variables with arguments to hold my expressions which are used through my application. I pass the variable the respective field to be calculated which works just fine. However, I cannot find a way to pass a function via the argument into the expression without error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Working example (in simple terms, where Num is the field that holds values):&lt;/P&gt;&lt;P&gt;Normal expression: sum(&lt;SPAN style="color: #0000ff;"&gt;Num&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;Variable for expression: vCalcSum = sum($1)&lt;/P&gt;&lt;P&gt;Called in expression: =$(vCalcSum(&lt;SPAN style="color: #0000ff;"&gt;Num&lt;/SPAN&gt;))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem example;&amp;nbsp; I cannot find a way to pass a function to the same variable, in this case using if():&lt;/P&gt;&lt;P&gt;Normal expression: sum(&lt;SPAN style="color: #0000ff;"&gt;if(Type=1,Num,0)&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;Variable for expression (same as above): vCalcSum = sum($1)&lt;/P&gt;&lt;P&gt;Called in expression: =$(vCalcSum(&lt;SPAN style="color: #0000ff;"&gt;if(Type=1,Num,0)&lt;/SPAN&gt;))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using $ expansion on the inner logic to no avail and am stuck. Thoughts, ideas, tricks??? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 19:04:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604223#M223258</guid>
      <dc:creator />
      <dc:date>2014-05-06T19:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Passing functions into variable arguments</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604224#M223259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try set analysis:&amp;nbsp; $(vCalcSum(&amp;nbsp; {&amp;lt;Type={1}&amp;gt;} Num&amp;nbsp; ))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 19:55:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604224#M223259</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-05-06T19:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Passing functions into variable arguments</title>
      <link>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604225#M223260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. For the simple if() in my example I can use set analysis, but I guess I was looking for a more comprehensive solution that would work for any type of function. Maybe a better example would have been:&lt;/P&gt;&lt;P&gt;if(Type=1,Num,Num*2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But then again, maybe I'm overthinking this!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 12:59:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Passing-functions-into-variable-arguments/m-p/604225#M223260</guid>
      <dc:creator />
      <dc:date>2014-05-07T12:59:01Z</dc:date>
    </item>
  </channel>
</rss>

