<?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: Nested if condition in load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1543852#M439652</link>
    <description>Thank you very much!</description>
    <pubDate>Wed, 13 Feb 2019 17:27:59 GMT</pubDate>
    <dc:creator>mja_jami</dc:creator>
    <dc:date>2019-02-13T17:27:59Z</dc:date>
    <item>
      <title>Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1539910#M439368</link>
      <description>&lt;P&gt;Hello Qlik Experts,&lt;/P&gt;&lt;P&gt;I’ve an existing script that is loading data, when I add one more condition generates error. Can anyone help me with the nested condition please? The data input fields are:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;policy_type&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;pfl&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;premium&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;livecount&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;policy_eff&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;AAA&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;N&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;4473.36&lt;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&lt;EM&gt;Y&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;125&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;2&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;1/1/2018&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;XYZ&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;N&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;-1872&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;50-&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1/1/2018&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Currently the script I’ve is:&lt;/P&gt;&lt;P&gt;if (policy_type = 'DDD' and policy_eff&amp;lt; '1/1/2019' and pfl &amp;lt;&amp;gt; 'N' and livecount &amp;gt; 50 and premium&amp;gt;0, premium*.85,&lt;/P&gt;&lt;P&gt;if (policy_type = 'DDD' and policy_eff&amp;lt; '1/1/2019' and pfl&amp;lt;&amp;gt;'N' and livecount &amp;lt;= 50 and premium&amp;gt;0, premium*.75,&lt;/P&gt;&lt;P&gt;if (policy_type = 'DDD' and policy_eff&amp;gt;= '1/1/2019' and pfl&amp;lt;&amp;gt;'N' and premium&amp;gt;0, premium*.92, 0))) as pfl_premium&lt;/P&gt;&lt;P&gt;I want to populate a calculated field pfl_premium by loading the records that have fields:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;policy_type = ‘DDD’&lt;/LI&gt;&lt;LI&gt;pfl =not equal ‘N so can be either ‘Y’ or BLANK/ NULL&lt;/LI&gt;&lt;LI&gt;premium &amp;gt; 0&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;and generate/ populate a field value pfl_premium for:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;policy_eff (dates before) &amp;lt; 1/1/2019:&lt;OL&gt;&lt;LI&gt;livecount &amp;lt; 50&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;pfl_premium: premium * .70&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;livecount &amp;gt;50&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;pfl_premium: premium * .80&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;policy_eff (dates after) &amp;gt;= 1/1/2019:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;pfl_premium: premium * .90 (doesn’t matter whatever the livecount)&lt;/P&gt;&lt;P&gt;anything else, populate 0, for example, if premium is -75, populate 0 in pfl_premium, if policy_type = anything but DDD populate 0, if pfl =&amp;nbsp; ‘N’ populate 0 in pfl_premium.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you please check my script and help me as I got different result comparing my excel calculation?&lt;/P&gt;&lt;P&gt;I sincerely appreciate your kind help. Thank you very much!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;mja&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 21:37:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1539910#M439368</guid>
      <dc:creator>mja_jami</dc:creator>
      <dc:date>2019-02-05T21:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1539963#M439369</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If(policy_type = 'DDD' and (pfl &amp;lt;&amp;gt; 'N' Or IsNull(pfl)) and premium &amp;gt; 0,
	If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;lt; 50, premium * 0.7,
		If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;gt;= 50, premium * 0.8, 
			0.9)
	, 0),
, 0) as pfl_premium,&lt;/PRE&gt;&lt;P&gt;Make sure that&amp;nbsp;policy_eff is a valid numeric date field and that the dates like '1/1/2019' are recognized by Qlik as dates (ie the default date format in the Set statements is D/M/YYYY or M/D/YYYY). Otherwise use MakeDate() or Date#() for these dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 05:58:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1539963#M439369</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2019-02-06T05:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1540340#M439389</link>
      <description>&lt;P&gt;Thank you very much for your help. I see error, possibly with the (,) when I pasted:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PFL Prem calculation Syntax.PNG" style="width: 709px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/5321i08EA82F3D4BDDF1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="PFL Prem calculation Syntax.PNG" alt="PFL Prem calculation Syntax.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and there are two commas here:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;, 0) as pfl_premium,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Jami&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 14:39:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1540340#M439389</guid>
      <dc:creator>mja_jami</dc:creator>
      <dc:date>2019-02-06T14:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1541753#M439488</link>
      <description>&lt;P&gt;Thank you very much. would you please take a look, why am I getting syntax error with the script:&lt;/P&gt;&lt;PRE&gt;If(policy_type = 'DDD' and (pfl &amp;lt;&amp;gt; 'N' Or IsNull(pfl)) and premium &amp;gt; 0,
	If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;lt; 50, premium * 0.7,
		If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;gt;= 50, premium * 0.8, 
			0.9)
	, 0),
, 0) as pfl_premium,&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PFL Prem calculation Syntax.PNG" style="width: 709px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/5577iA7977C79C5BC02C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="PFL Prem calculation Syntax.PNG" alt="PFL Prem calculation Syntax.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;while, trying to fix it with:&lt;/P&gt;&lt;P&gt;If(policy_type = 'DBL' and (pfl &amp;lt;&amp;gt; 'N' Or IsNull(pfl)) and premium &amp;gt; 0,&lt;BR /&gt;If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;lt;= 50, premium * 0.75,&lt;BR /&gt;If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;gt; 50, premium * 0.85,&lt;BR /&gt;0.92)), 0) as pfl_premium,&amp;nbsp;&lt;/P&gt;&lt;P&gt;my calculation goes off, excel gives me different number than qlik load data.&lt;/P&gt;&lt;P&gt;I sincerely appreciate your time and effort.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Jami&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 17:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1541753#M439488</guid>
      <dc:creator>mja_jami</dc:creator>
      <dc:date>2019-02-08T17:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1543415#M439621</link>
      <description>&lt;P&gt;Perhaps this:&lt;/P&gt;&lt;PRE&gt;If(policy_type = 'DDD' and (pfl &amp;lt;&amp;gt; 'N' Or IsNull(pfl)) and premium &amp;gt; 0,
	If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;lt; 50, premium * 0.7,
		If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;gt;= 50, premium * 0.8, 
			0.9))
, 0) as pfl_premium,&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Feb 2019 07:05:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1543415#M439621</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2019-02-13T07:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1543852#M439652</link>
      <description>Thank you very much!</description>
      <pubDate>Wed, 13 Feb 2019 17:27:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1543852#M439652</guid>
      <dc:creator>mja_jami</dc:creator>
      <dc:date>2019-02-13T17:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if condition in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1560200#M441249</link>
      <description>&lt;P&gt;Happy Friday!&lt;/P&gt;&lt;P&gt;I was wondering where to change if I want to include the negative premiums and do the same calculation. The following script calculates for&amp;nbsp;pfl_premium only when&amp;nbsp;premium &amp;gt; 0.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If(policy_type = 'DDD' and (pfl &amp;lt;&amp;gt; 'N' Or IsNull(pfl)) and premium &amp;gt; 0,
	If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;lt; 50, premium * 0.7,
		If(policy_eff&amp;lt; '1/1/2019' and livecount &amp;gt;= 50, premium * 0.8, 
			0.9))
, 0) as pfl_premium,&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Now, I need to calculate the (-) premiums too and turn the&amp;nbsp;pfl_premium amount into positive amount with the same calculation. Where can I change?&lt;BR /&gt;Please help. Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 15:32:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-condition-in-load-script/m-p/1560200#M441249</guid>
      <dc:creator>mja_jami</dc:creator>
      <dc:date>2019-03-22T15:32:39Z</dc:date>
    </item>
  </channel>
</rss>

