<?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: If ..then ..else .. in an expression possible ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539468#M747099</link>
    <description>&lt;P&gt;If I may add to an issue that has been expertly handled already, in QlikView script there are two IF constructs:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The &lt;A title="If..then..elseif..else..end if - QlikView" href="https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptControlStatements/If.htm" target="_self"&gt;IF statement&lt;/A&gt; is to be used on the outer statement level, even inside other IF statements. It follows the classical IF THEN ELSE END IF format that is common in other programming languages.&lt;/LI&gt;&lt;LI&gt;The &lt;A title="if - script and chart function - QlikView" href="https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/if.htm" target="_self"&gt;IF() function&lt;/A&gt; is to be used in all expressions (you can't use an IF statement in an expression). It follows regular calling conventions with parameters: 2 are fixed (the condition and the true-expression), 1 is optional (the false-expression)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;As a result, you can only mingle IF functions in column expressions in a LOAD statement. You cannot use IF THEN ELSE inside a LOAD statement. The net result on the other hand is identical: conditional execution/evaluation.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Feb 2019 08:54:26 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2019-02-05T08:54:26Z</dc:date>
    <item>
      <title>If ..then ..else .. in an expression possible ?</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539296#M747096</link>
      <description>&lt;P&gt;So I have&amp;nbsp;two conditional flag s&amp;nbsp;&lt;/P&gt;&lt;P&gt;If ForeignFlag =1&amp;nbsp; &amp;nbsp; show foreign values&amp;nbsp; &amp;nbsp;... if there are no foreign values&amp;nbsp; then..&lt;/P&gt;&lt;P&gt;If StateFlag = 0&amp;nbsp; &amp;nbsp;show&amp;nbsp; state values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I incorporate this into the expression with else statement ?&lt;/P&gt;&lt;P&gt;if($(vFilter)=1 and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ForeignFlag=1&lt;/STRONG&gt;&amp;nbsp;, EntityNumber &amp;amp;'-'&amp;amp; EntityName ,&lt;/P&gt;&lt;P&gt;if($(vFilter)=4 and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;EntityTypeFlag=1&lt;/STRONG&gt;, EntityNumber &amp;amp;'-'&amp;amp;&amp;nbsp; EnterpriseName,))&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539296#M747096</guid>
      <dc:creator>claudialet</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: If ..then ..else .. in an expression possible ?</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539304#M747097</link>
      <description>&lt;P&gt;For this, rather than an if you can just use "set analysis" to get what you whant this can work like an if or where(from SQL)&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 20:27:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539304#M747097</guid>
      <dc:creator>PauloHSantos</dc:creator>
      <dc:date>2019-02-04T20:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: If ..then ..else .. in an expression possible ?</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539335#M747098</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If, then, else is totally possible, but it differs a bit depending on where you are doing it.&lt;/P&gt;&lt;P&gt;Are these fields in a table you are loading? If so the syntax is a bit like this:&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;&amp;nbsp; if(ForeignFlag = 1, [Foreign Values], if(StateFlag=0, [State Values], 'Neither Foreign or State')) as [Field Name],&lt;/P&gt;&lt;P&gt;If you are doing it in a chart expression it is very similar, except you would not have the "as [Field Name],". You would also typically have an aggregation, such as a Sum, to give you totals:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;sum(if(ForeignFlag = 1, [Foreign Values], if(StateFlag=0, [State Values], 0)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The load script also has VB style if then else blocks:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if ForeignFlag = 1 then&lt;BR /&gt;&amp;nbsp; LOAD&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ForeignValues...&lt;BR /&gt;else&lt;BR /&gt;&amp;nbsp; if StateFlag = 0 then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LOAD&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StateValues...&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end if&lt;BR /&gt;end if&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code you posted looks fine, but to have a null value returned if neither expression is true you either need to lose that last comma, or have ", null()". Having the comma without a value after may cause it to break.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 22:09:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539335#M747098</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2019-02-04T22:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: If ..then ..else .. in an expression possible ?</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539468#M747099</link>
      <description>&lt;P&gt;If I may add to an issue that has been expertly handled already, in QlikView script there are two IF constructs:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The &lt;A title="If..then..elseif..else..end if - QlikView" href="https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptControlStatements/If.htm" target="_self"&gt;IF statement&lt;/A&gt; is to be used on the outer statement level, even inside other IF statements. It follows the classical IF THEN ELSE END IF format that is common in other programming languages.&lt;/LI&gt;&lt;LI&gt;The &lt;A title="if - script and chart function - QlikView" href="https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/if.htm" target="_self"&gt;IF() function&lt;/A&gt; is to be used in all expressions (you can't use an IF statement in an expression). It follows regular calling conventions with parameters: 2 are fixed (the condition and the true-expression), 1 is optional (the false-expression)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;As a result, you can only mingle IF functions in column expressions in a LOAD statement. You cannot use IF THEN ELSE inside a LOAD statement. The net result on the other hand is identical: conditional execution/evaluation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 08:54:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-else-in-an-expression-possible/m-p/1539468#M747099</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2019-02-05T08:54:26Z</dc:date>
    </item>
  </channel>
</rss>

