<?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 to include If(Match(IsNull and work in acsending order in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944272#M1219506</link>
    <description>&lt;P&gt;First, I think the&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;I&lt;SPAN&gt;snull(INTENDED_MANAGEMENT, 'xx')&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;is a conceit from SQL because SQL doesn't like NULL to the left of an IN() operator. Not a problem for Qlik so you can write it like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Match(INTENDED_MANAGEMENT, '2', '4')&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Doesn't matter if&amp;nbsp;INTENDED_MANAGEMENT in null or not.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My crack at the whole conversion:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;If(Match(INTENDED_MANAGEMENT, '2', '4')&lt;BR /&gt;and IsNull(DISCHARGE_DATE)&lt;BR /&gt;and ADMISSION_DATE = Today(1)&lt;BR /&gt;'D'&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;,If(Match(INTENDED_MANAGEMENT, '2', '4')&lt;BR /&gt;and not IsNull(DISCHARGE_DATE)&lt;BR /&gt;and ADMISSION_DATE = DISCHARGE_DATE&lt;BR /&gt;'D'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;,if(Match(ADMIT_SOURCE, '11', '12', '13'), 'NON ELEC', 'ELEC'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;))) as&amp;nbsp;PATIENT_TYPE&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note I did not convert the last three lines of the SQL because I can't see how they would ever be hit. One of the previous ADMIT_SOURCE tests must be true.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If ADMISSION_DATE &amp;amp; DISCHARGE are timestamps, you should wrap them in Floor() in the Qlik expression.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 14:48:26 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2022-06-16T14:48:26Z</dc:date>
    <item>
      <title>If statement to include If(Match(IsNull and work in acsending order</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944178#M1219490</link>
      <description>&lt;P&gt;Hello there&lt;/P&gt;
&lt;P&gt;I have to replicate an if statement from SQL server into Qlikview language and make sure that the statement reads from top to bottom, I.e. if your not this, then your this scenario&lt;/P&gt;
&lt;P&gt;I have got so far, but am struggling with the If(Match(IsNull scenarios, so thought I would look for help from the community as although I love problem solving, I am on a tight trunaround&lt;/P&gt;
&lt;P&gt;I thought I would post the original SQL server statement and then&amp;nbsp; &amp;nbsp;what I have done in Qlik so far&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Original (SQL SERVER)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PATIENT_TYPE = CASE&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;WHEN Isnull(INTENDED_MANAGEMENT, 'xx') IN( '2', '4' )&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; AND DISCHARGE_DATE IS NULL&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;AND &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; Datediff(day, ADMISSION_DATE , Getdate()) = 0 THEN 'D'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; WHEN Isnull(INTENDED_MANAGEMENT, 'xx') IN( '2', '4' )&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; AND DISCHARGE_DATE IS NOT NULL&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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;AND Datediff(day, ADMISSION_DATE, DISCHARGE_DATE) = 0 THEN 'D'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; WHEN ADMIT_SOURCE NOT IN ( '12', '13', '11' ) THEN 'E'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; WHEN ADMIT_SOURCE IN ( '12', '13', '11' ) THEN 'NON ELEC'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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;WHEN ADMIT_SOURCE IN ( '2', '4' )&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; AND DISCHARGE_DATE IS NOT NULL&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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; AND DISCHARGE_DATE &amp;gt; ADMISSION_DATE THEN 'I'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&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;END&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Qlikview Attempt&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF(MATCH(ISNULL(INTENDED_MANAGEMENT),'XX', '2', '4') AND ISNULL(DISCHARGE_DATE) AND DATE(ADMIT_DATE,'DD/MM/YYYY')- DATE(TODAY(),'DD/MM/YYYY') = 0, 'D',&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;IF(MATCH(INTENDED_MANAGEMENT, '2', '4') AND DATE(ADMIT_DATE,'DD/MM/YYYY')- DATE(DISCHARGE_DATE,'DD/MM/YYYY') = 0, 'DAYCASE',&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;IF(NOT MATCH(ADMIT_SOURCE, '11', '12', '13'), 'E',&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;IF(MATCH(ADMIT_SOURCE, '11', '12', '13'), 'NON ELEC',&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;IF(MATCH(ADMIT_SOURCE, '2', '4') AND DATE(DISCHARGE_DATE,'DD/MM/YYYY') &amp;gt; DATE(ADMIT_DATE,'DD/MM/YYYY'), 'I',&lt;BR /&gt;)))))&amp;nbsp;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;////////////////////&lt;/P&gt;
&lt;P&gt;I think I am struggling with the is null and matches and NOT Nulls....Could someone cast an eye to see if they can spot where I am going wrong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 17:25:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944178#M1219490</guid>
      <dc:creator>helen_pip</dc:creator>
      <dc:date>2022-06-15T17:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: If statement to include If(Match(IsNull and work in acsending order</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944272#M1219506</link>
      <description>&lt;P&gt;First, I think the&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;I&lt;SPAN&gt;snull(INTENDED_MANAGEMENT, 'xx')&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;is a conceit from SQL because SQL doesn't like NULL to the left of an IN() operator. Not a problem for Qlik so you can write it like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Match(INTENDED_MANAGEMENT, '2', '4')&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Doesn't matter if&amp;nbsp;INTENDED_MANAGEMENT in null or not.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My crack at the whole conversion:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;If(Match(INTENDED_MANAGEMENT, '2', '4')&lt;BR /&gt;and IsNull(DISCHARGE_DATE)&lt;BR /&gt;and ADMISSION_DATE = Today(1)&lt;BR /&gt;'D'&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;,If(Match(INTENDED_MANAGEMENT, '2', '4')&lt;BR /&gt;and not IsNull(DISCHARGE_DATE)&lt;BR /&gt;and ADMISSION_DATE = DISCHARGE_DATE&lt;BR /&gt;'D'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;,if(Match(ADMIT_SOURCE, '11', '12', '13'), 'NON ELEC', 'ELEC'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;))) as&amp;nbsp;PATIENT_TYPE&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note I did not convert the last three lines of the SQL because I can't see how they would ever be hit. One of the previous ADMIT_SOURCE tests must be true.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If ADMISSION_DATE &amp;amp; DISCHARGE are timestamps, you should wrap them in Floor() in the Qlik expression.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 14:48:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944272#M1219506</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-06-16T14:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: If statement to include If(Match(IsNull and work in acsending order</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944518#M1219519</link>
      <description>&lt;P&gt;Hello there&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would just like to say thank you for your answer, this worked for me&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much&lt;/P&gt;
&lt;P&gt;Helen&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 11:21:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-to-include-If-Match-IsNull-and-work-in-acsending/m-p/1944518#M1219519</guid>
      <dc:creator>helen_pip</dc:creator>
      <dc:date>2022-06-16T11:21:40Z</dc:date>
    </item>
  </channel>
</rss>

