<?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: Comparing two dates and two times where nulls exist in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1634141#M47237</link>
    <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;This appears to have worked.&amp;nbsp; I am checking through some of the other use cases but the specific example I screenshotted has flipped to be On Time as it should be.&lt;/P&gt;&lt;P&gt;Thanks for the assistance, it's much appreciated, I'll check back again when I have done some further analysis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Oct 2019 09:19:14 GMT</pubDate>
    <dc:creator>acholchemit</dc:creator>
    <dc:date>2019-10-11T09:19:14Z</dc:date>
    <item>
      <title>Comparing two dates and two times where nulls exist</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1633564#M47173</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a problem where I need to compare a date field and time field with another date field and time field.&amp;nbsp; The issue is that the data is dirty and so 3 of the four fields could contain nulls.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to do this comparison in order to determine if a delivery is late or on time (including early).&amp;nbsp;&lt;/P&gt;&lt;P&gt;As there are nulls my theory was to 'force' a date or time into the field where there are nulls in order to allow the comparison to work.&amp;nbsp; Unfortunately this doesn't seem to work despite the output looking valid.&lt;/P&gt;&lt;P&gt;The relevant script is as follows;&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;//Doing the comparison&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;IF([PurchaseRcptLine ReceiptDT] &amp;gt; [PurchaseRcptLine PromisedDT], 'Late', 'On Time') AS [PurchaseRcptLine Late/On Time2];&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333399"&gt;//Firstly building the two fields to compare&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#003300"&gt;Timestamp#([PurchaseRcptLine Posting Date] &amp;amp; ' ' &amp;amp; IF(ISNull([PurchaseRcptLine Actual Receipt Time]),Time#('00:01'),[PurchaseRcptLine Actual Receipt Time]),'DD/MM/YYYY hh:mm') AS [PurchaseRcptLine ReceiptDT],&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#003300"&gt;Timestamp#(IF(ISNULL([PurchaseRcptLine Promised Receipt Date]),'31/12/2019',[PurchaseRcptLine Promised Receipt Date]) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#003300"&gt;&amp;amp; ' ' &amp;amp; IF(ISNULL([PurchaseRcptLine Requested Receipt Time]),Time#('23:59'),[PurchaseRcptLine Requested Receipt Time]),'DD/MM/YYYY hh:mm') AS [PurchaseRcptLine PromisedDT];&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The output ends up like this with the flag showing as Late when it should be On Time.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_0.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/21132i36BAA26BED028AAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_0.png" alt="clipboard_image_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can anyone shed any light on what is happening\ what I am doing wrong?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:55:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1633564#M47173</guid>
      <dc:creator>acholchemit</dc:creator>
      <dc:date>2024-11-16T19:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates and two times where nulls exist</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1633842#M47209</link>
      <description>&lt;P&gt;It would be nice to have a sample data. I need to understand the nature of the dirty data to be able to apply the correct transformation.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 17:54:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1633842#M47209</guid>
      <dc:creator>jerifortune</dc:creator>
      <dc:date>2019-10-10T17:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates and two times where nulls exist</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1633877#M47211</link>
      <description>&lt;P&gt;May be try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD *,

//Firstly building the two fields to compare

TimeStamp#([PurchaseRcptLine Posting Date] &amp;amp; ' ' &amp;amp; If(IsNull([PurchaseRcptLine Actual Receipt Time]), Time#('00:01'), Time([PurchaseRcptLine Actual Receipt Time], 'hh:mm')), 'DD/MM/YYYY hh:mm') as [PurchaseRcptLine ReceiptDT],

TimeStamp#(If(IsNull([PurchaseRcptLine Promised Receipt Date]), '31/12/2019', [PurchaseRcptLine Promised Receipt Date]) &amp;amp; ' ' &amp;amp; If(IsNull([PurchaseRcptLine Requested Receipt Time]), Time#('23:59'), Time([PurchaseRcptLine Requested Receipt Time], 'hh:mm')), 'DD/MM/YYYY hh:mm') as [PurchaseRcptLine PromisedDT];&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 18:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1633877#M47211</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-10-10T18:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates and two times where nulls exist</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1634141#M47237</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;This appears to have worked.&amp;nbsp; I am checking through some of the other use cases but the specific example I screenshotted has flipped to be On Time as it should be.&lt;/P&gt;&lt;P&gt;Thanks for the assistance, it's much appreciated, I'll check back again when I have done some further analysis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 09:19:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1634141#M47237</guid>
      <dc:creator>acholchemit</dc:creator>
      <dc:date>2019-10-11T09:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates and two times where nulls exist</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1634201#M47243</link>
      <description>&lt;P&gt;Just to confirm, Sunny's solution has worked and so i will mark it as the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 11:07:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-two-dates-and-two-times-where-nulls-exist/m-p/1634201#M47243</guid>
      <dc:creator>acholchemit</dc:creator>
      <dc:date>2019-10-11T11:07:40Z</dc:date>
    </item>
  </channel>
</rss>

