<?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 Nested user defined function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nested-user-defined-function/m-p/301539#M496437</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'm creating a user defined function as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET GetUSDRate = &lt;/P&gt;&lt;P&gt;if((not IsNull($1)) and (len($1) &amp;gt; 0) and (IsNum($1)) and ($1 &amp;lt;&amp;gt; 0),$1,if((not IsNull($2)) and (len($2) &amp;gt; 0) and (IsNum($2)) and ($2 &amp;lt;&amp;gt; 0),$2,$3));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I pass in 3 rates and it returns the first non-null non-zero rate it finds.&amp;nbsp; What I want to do is make one of the parameters I pass in the result of a different function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my call looks something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(GetUSDRate(0,[Override USD Rate],[FX Currency USD Rate]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to know is how can I replace the first parameter of zero with the result of a function, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(GetUSDRate( &lt;STRONG&gt;$(NewFunction(param1))&lt;/STRONG&gt;,[Override USD Rate],[FX Currency USD Rate]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried something like above but it doesn't work.&amp;nbsp; I can't use variables as this is a set based operation and the result of "NewFunction" is based on data specific to each row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to QV so I might be going about this completely the wrong way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this makes sense.&amp;nbsp; Any help appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Gregg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Dec 2011 01:24:51 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-12-15T01:24:51Z</dc:date>
    <item>
      <title>Nested user defined function</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-user-defined-function/m-p/301539#M496437</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'm creating a user defined function as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET GetUSDRate = &lt;/P&gt;&lt;P&gt;if((not IsNull($1)) and (len($1) &amp;gt; 0) and (IsNum($1)) and ($1 &amp;lt;&amp;gt; 0),$1,if((not IsNull($2)) and (len($2) &amp;gt; 0) and (IsNum($2)) and ($2 &amp;lt;&amp;gt; 0),$2,$3));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I pass in 3 rates and it returns the first non-null non-zero rate it finds.&amp;nbsp; What I want to do is make one of the parameters I pass in the result of a different function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my call looks something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(GetUSDRate(0,[Override USD Rate],[FX Currency USD Rate]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to know is how can I replace the first parameter of zero with the result of a function, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(GetUSDRate( &lt;STRONG&gt;$(NewFunction(param1))&lt;/STRONG&gt;,[Override USD Rate],[FX Currency USD Rate]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried something like above but it doesn't work.&amp;nbsp; I can't use variables as this is a set based operation and the result of "NewFunction" is based on data specific to each row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to QV so I might be going about this completely the wrong way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this makes sense.&amp;nbsp; Any help appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Gregg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2011 01:24:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-user-defined-function/m-p/301539#M496437</guid>
      <dc:creator />
      <dc:date>2011-12-15T01:24:51Z</dc:date>
    </item>
  </channel>
</rss>

