<?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 Statement in script is not working well in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334246#M704202</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WORKS GREAT&amp;nbsp; MANY THANX FOR YOUR GREAT EXPLANATION !!!&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Jun 2012 12:21:43 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-06-02T12:21:43Z</dc:date>
    <item>
      <title>IF Statement in script is not working well</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334244#M704200</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;&lt;/P&gt;&lt;P&gt;This is what i want to achieve&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; in case OPNTYPE = K AND&amp;nbsp;&amp;nbsp; EINDDAT = &amp;gt; TODAY+150 or&amp;nbsp; EINDDAT is NULL&amp;nbsp; EINDMUT should be&amp;nbsp; INGDAT&lt;/P&gt;&lt;P&gt;In case OPNTYPE = D AND&amp;nbsp;&amp;nbsp; EINDDAT = &amp;gt; TODAY+150 or&amp;nbsp; EINDDAT is NULL&amp;nbsp; EINDMUT should be&amp;nbsp; INGDAT+3 &lt;/P&gt;&lt;P&gt;In all other cases the EINDDAT is correct and EINDMUT should be the same as EINDDAT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here for I use this statement in my script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlannrAfd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(OPNTYPE='K' AND ISNULL(EINDDAT) OR EINDDAT&amp;gt; Today()+150,INGDAT+3,EINDDAT), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(OPNTYPE='D' AND ISNULL(EINDDAT) OR EINDDAT&amp;gt; Today()+150,INGDAT,EINDDAT)),&lt;/P&gt;&lt;P&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;'dd-MM-YYYY hh:mm') as EINDMUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But is is not working well as the result of&lt;/P&gt;&lt;P&gt;PLANNR 123 OPNTYPE=K INGDAT = 6-12-2012,&amp;nbsp; EINDDAT 31-12-2999 is resulting in EINDMUT 06-12-2011 ,&lt;/P&gt;&lt;P&gt;Which is corresponding with the statement for OPNTYPE 'D'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gratefull greeetings to those who can help !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2012 08:33:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334244#M704200</guid>
      <dc:creator />
      <dc:date>2012-06-02T08:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement in script is not working well</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334245#M704201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi 2perform,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a couple of things wrong with the nested if statement as far as I can see. Firstly the logic test needs changing by wrapping another set of brackets round the "OR" part ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPNTYPE='K' AND &lt;STRONG&gt;(&lt;/STRONG&gt;ISNULL(EINDDAT) OR EINDDAT&amp;gt; Today()+150&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... then you need to structure the full statement like this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if( {logic test 1} , {value if true}, if( {logic test 2} , {value if true}, {value if false}) ) as fieldname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't tested this but I think the statement should be something like ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlannrAfd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(OPNTYPE='K' AND (ISNULL(EINDDAT) OR EINDDAT&amp;gt; Today()+150),INGDAT+3,&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; If(OPNTYPE='D' AND (ISNULL(EINDDAT) OR EINDDAT&amp;gt; Today()+150),INGDAT,EINDDAT)) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dd-MM-YYYY hh:mm') as EINDMUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS Just noticed your original case specification and query seem to have swapped the INGDAT &amp;amp; INGDAT+3 values, so not sure which you need - you might need to swap them over in my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2012 09:32:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334245#M704201</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-06-02T09:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement in script is not working well</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334246#M704202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WORKS GREAT&amp;nbsp; MANY THANX FOR YOUR GREAT EXPLANATION !!!&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2012 12:21:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-in-script-is-not-working-well/m-p/334246#M704202</guid>
      <dc:creator />
      <dc:date>2012-06-02T12:21:43Z</dc:date>
    </item>
  </channel>
</rss>

