<?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: Compare dates between two tables in the script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788503#M61564</link>
    <description>&lt;P&gt;This should add a [Previous Appointment ID] to your Admissions table based on the most recent Appointment for a patient in the Appointments table prior to the patients admissions data.&amp;nbsp; (It is only tested on your limited data set, so you may need to tweak it, but the concept should work.&amp;nbsp; Also, you may want to drop the [Previous Appointment Date] from the Admissions table if it is not needed.)&lt;/P&gt;&lt;P&gt;AdmissionsTemp:&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Admission Date]&lt;BR /&gt;Resident Admissions;&lt;/P&gt;&lt;P&gt;Left Join (AdmissionsTemp)&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Appointment Date]&lt;BR /&gt;Resident Appointments;&lt;/P&gt;&lt;P&gt;AdmissionsTemp2:&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Admission Date],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date(max([Appointment Date])) as [Previous Appointment Date]&lt;BR /&gt;Resident AdmissionsTemp&lt;BR /&gt;where [Appointment Date] &amp;lt; [Admission Date]&lt;BR /&gt;group by [Patient ID],[Admission Date];&lt;/P&gt;&lt;P&gt;Left Join (AdmissionsTemp2)&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Appointment Date] as [Previous Appointment Date],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Appointment ID] as [Previous Appointment ID]&lt;BR /&gt;Resident Appointments;&lt;/P&gt;&lt;P&gt;Join (Admissions)&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Admission Date],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Previous Appointment ID]&lt;BR /&gt;Resident AdmissionsTemp2;&lt;/P&gt;&lt;P&gt;Drop Tables AdmissionsTemp, AdmissionsTemp2;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 19:29:31 GMT</pubDate>
    <dc:creator>GaryGiles</dc:creator>
    <dc:date>2021-03-04T19:29:31Z</dc:date>
    <item>
      <title>Compare dates between two tables in the script</title>
      <link>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788357#M61552</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I've been struggling with this problem for quite some time now, which in my head seems to be simple but I can't figure out a solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables loaded in my app: &lt;STRONG&gt;Admissions&lt;/STRONG&gt; and &lt;STRONG&gt;Appointments&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Admissions&lt;/STRONG&gt; contains the records of when the patient was admitted at the hospital. Here is a simplified version of the table:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Admission ID&lt;/TD&gt;&lt;TD&gt;Patient ID&lt;/TD&gt;&lt;TD&gt;Admission Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a1&lt;/TD&gt;&lt;TD&gt;p1&lt;/TD&gt;&lt;TD&gt;01/01/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a2&lt;/TD&gt;&lt;TD&gt;p1&lt;/TD&gt;&lt;TD&gt;02/01/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a3&lt;/TD&gt;&lt;TD&gt;p2&lt;/TD&gt;&lt;TD&gt;02/01/2020&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appointments contains the appointments each patient attended in a clinic&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Appointment ID&lt;/TD&gt;&lt;TD&gt;Patient ID&lt;/TD&gt;&lt;TD&gt;Appointment Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;app1&lt;/TD&gt;&lt;TD&gt;p1&lt;/TD&gt;&lt;TD&gt;01/01/2019&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;app2&lt;/TD&gt;&lt;TD&gt;p3&lt;/TD&gt;&lt;TD&gt;01/03/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;app3&lt;/TD&gt;&lt;TD&gt;p4&lt;/TD&gt;&lt;TD&gt;02/10/2020&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to check the&amp;nbsp;against each admission the&amp;nbsp;&lt;STRONG&gt;Previous&lt;/STRONG&gt; appointment this patient attended, by comparing the &lt;U&gt;Admission date&lt;/U&gt; with the &lt;U&gt;Appointment Date.&lt;/U&gt; Ideally by making a reference to the &lt;STRONG&gt;AppointmentID&amp;nbsp;&lt;/STRONG&gt;in an additional column while loading the Admissions table.&lt;/P&gt;&lt;P&gt;Can anybody give me some direction?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 14:57:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788357#M61552</guid>
      <dc:creator>eugabgomes</dc:creator>
      <dc:date>2021-03-04T14:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compare dates between two tables in the script</title>
      <link>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788503#M61564</link>
      <description>&lt;P&gt;This should add a [Previous Appointment ID] to your Admissions table based on the most recent Appointment for a patient in the Appointments table prior to the patients admissions data.&amp;nbsp; (It is only tested on your limited data set, so you may need to tweak it, but the concept should work.&amp;nbsp; Also, you may want to drop the [Previous Appointment Date] from the Admissions table if it is not needed.)&lt;/P&gt;&lt;P&gt;AdmissionsTemp:&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Admission Date]&lt;BR /&gt;Resident Admissions;&lt;/P&gt;&lt;P&gt;Left Join (AdmissionsTemp)&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Appointment Date]&lt;BR /&gt;Resident Appointments;&lt;/P&gt;&lt;P&gt;AdmissionsTemp2:&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Admission Date],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date(max([Appointment Date])) as [Previous Appointment Date]&lt;BR /&gt;Resident AdmissionsTemp&lt;BR /&gt;where [Appointment Date] &amp;lt; [Admission Date]&lt;BR /&gt;group by [Patient ID],[Admission Date];&lt;/P&gt;&lt;P&gt;Left Join (AdmissionsTemp2)&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Appointment Date] as [Previous Appointment Date],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Appointment ID] as [Previous Appointment ID]&lt;BR /&gt;Resident Appointments;&lt;/P&gt;&lt;P&gt;Join (Admissions)&lt;BR /&gt;Load [Patient ID],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Admission Date],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Previous Appointment ID]&lt;BR /&gt;Resident AdmissionsTemp2;&lt;/P&gt;&lt;P&gt;Drop Tables AdmissionsTemp, AdmissionsTemp2;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 19:29:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788503#M61564</guid>
      <dc:creator>GaryGiles</dc:creator>
      <dc:date>2021-03-04T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compare dates between two tables in the script</title>
      <link>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788631#M61578</link>
      <description>&lt;P&gt;Hi Gary,&lt;/P&gt;&lt;P&gt;thanks for the solution. that worked perfectly!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 10:20:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Compare-dates-between-two-tables-in-the-script/m-p/1788631#M61578</guid>
      <dc:creator>eugabgomes</dc:creator>
      <dc:date>2021-03-05T10:20:20Z</dc:date>
    </item>
  </channel>
</rss>

