<?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: Is there a function that returns the first non-null parameter? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236546#M87722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly explain how this function will work , how the parameters are substituted here ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 May 2013 08:18:18 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-05-08T08:18:18Z</dc:date>
    <item>
      <title>Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236542#M87718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;is there a function that returns the first non-null parameter and has a variable number of parameters? This feels like it belongs in the Range...(...) family of functions, but I've looked through this list without finding it. So, the function I'm looking (which I'll call RangeFirst, for the sake of argument) for would, for example, return 5 if invoked as RangeFirst(null(),null(),5,6,7,4).&lt;/P&gt;&lt;P&gt;I'm finding I regularly write expressions like&lt;/P&gt;&lt;P&gt;if(isnull(expr1),expr2,expr1)&lt;/P&gt;&lt;P&gt;but I'd prefer to avoid the expressive clumsiness with a function like what I'm looking for, so that my example would more simply be RangeFirst(expr1,expr2).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Angus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 03:36:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236542#M87718</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-02T03:36:41Z</dc:date>
    </item>
    <item>
      <title>Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236543#M87719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For numeric values, the function is Alt().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 04:29:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236543#M87719</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-05-02T04:29:18Z</dc:date>
    </item>
    <item>
      <title>Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236544#M87720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;that's helpful to keep in mind next time I'm wanting to do this with numerics.&lt;/P&gt;&lt;P&gt;Unfortunately, I'm wanting at present to do this with strings &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; . Hope sprang forth when I found WildMatch(), but was dashed on the rocks when I realised that it matches a series of wildcard expressions to a single string, whereas I'd be wanting to the opposite i.e. something like FirstMatchingString('*',str1,str2,str3...).&lt;/P&gt;&lt;P&gt;Any other options? Or will I need to run with the nested if()s?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Angus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 05:08:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236544#M87720</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2011-05-02T05:08:29Z</dc:date>
    </item>
    <item>
      <title>Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236545#M87721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can build your own variable function to make the nested if solution easier. Create a variable like this in your script (or via Variable Editor)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET AltString = &lt;/P&gt;&lt;P&gt;if(NOT IsNull($1), $1&lt;/P&gt;&lt;P&gt;,if(NOT IsNull($2), $2&lt;/P&gt;&lt;P&gt;,if(NOT IsNull($3), $3&lt;/P&gt;&lt;P&gt;,if(NOT IsNull($4), $4&lt;/P&gt;&lt;P&gt;, ''&lt;/P&gt;&lt;P&gt;)))&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add as many $n values as you think your max parm count. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use the function in script or charts like&lt;/P&gt;&lt;P&gt;=$(AltString(null(), 5, 'abc'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 20:11:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236545#M87721</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-05-12T20:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236546#M87722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly explain how this function will work , how the parameters are substituted here ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 08:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236546#M87722</guid>
      <dc:creator />
      <dc:date>2013-05-08T08:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236547#M87723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;qlik_techie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this feature is called &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Dollar-Sign Expansion with Parameters&lt;/H2&gt;&lt;P&gt;Parameters can be used in variable expansions. The variable must then contain formal parameters, such as $1, $2, $3 etc. When expanding the variable, the parameters should be stated in a comma separated list. &lt;/P&gt;&lt;P class="example"&gt;&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P class="Code"&gt;set MUL=’$1*$2’;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL(3,7)); //&lt;/SPAN&gt; returns '3*7' in X&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;let X=$(MUL(3,7)); //&lt;/SPAN&gt; returns 21 in X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the number of formal parameters exceeds the number of actual parameters only the formal parameters corresponding to actual parameters will be expanded. If the number of actual parameters exceeds the number of formal parameters the superfluous actual parameters will be ignored. &lt;/P&gt;&lt;P class="example"&gt;&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P class="Code"&gt;set MUL=’$1*$2’;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL); //&lt;/SPAN&gt; returns '$1*$2' in X&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL(10)); //&lt;/SPAN&gt; returns '10*$2' in X&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;let X=$(MUL(5,7,8)); //&lt;/SPAN&gt; returns 35 in X &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parameter $0 returns the number of parameters actually passed by a call. &lt;/P&gt;&lt;P class="example"&gt;&lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P class="Code"&gt;set MUL='$1*$2 $0 par'; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL(3,7)); //&lt;/SPAN&gt; returns '3*7 2 par' in X&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 10:13:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236547#M87723</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-05-08T10:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a function that returns the first non-null parameter?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236548#M87724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is maybe another alternative to the OP's request:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=subfield(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat( &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valuelist(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt; NULL(), 1/0,'First', 'Second'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '|'),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '|',1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will return 'First' (first non-Null list element) if used in e.g. a text box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I used '|' as a separator, but this can be changed to any appropriate separator (should not be part of the list elements themselfs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;Too bad, concat sorts its elements alphabetically. So, we would need to somehow tell QV to use the exact same order as stated in the valuelist() function arguments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's kind of late and this is getting messy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=subfield(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valuelist(dual(NULL(),1), dual(1/0,2),dual('Second',3),dual( 'First',4) ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '|',&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valuelist(dual(NULL(),1), dual(1/0,2),dual('Second',3),dual( 'First',4) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),'|',1 )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 10:18:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-function-that-returns-the-first-non-null-parameter/m-p/236548#M87724</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-05-08T10:18:36Z</dc:date>
    </item>
  </channel>
</rss>

