<?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: How to get the latest status from date per ID in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989105#M81750</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/164519"&gt;@Saif1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;In UI you can use the below expression:&lt;BR /&gt;if( FirstSortedValue( [Emp Status], -Date) = 'Did not attend exam', 'Rejected', FirstSortedValue( [Emp Status], -Date) )&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 12:49:45 GMT</pubDate>
    <dc:creator>agigliotti</dc:creator>
    <dc:date>2022-10-05T12:49:45Z</dc:date>
    <item>
      <title>How to get the latest status from date per ID</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989020#M81736</link>
      <description>&lt;P&gt;Hello Qlikers,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My case is that i have multiple employees that has some recruitment status :&lt;/P&gt;
&lt;P&gt;EMP num, Emp Name , Emp Status&amp;nbsp; &amp;nbsp; &amp;nbsp; Date&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sent request&amp;nbsp; &amp;nbsp;1/9/2022&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Attend Exam&amp;nbsp; &amp;nbsp; 5/9/2022&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Interview&amp;nbsp; &amp;nbsp; 10/9/2022&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Accepted&amp;nbsp; &amp;nbsp;30/9/2022&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sent request&amp;nbsp; &amp;nbsp;10/10/2022&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Did not attend exam&amp;nbsp; &amp;nbsp;21/10/2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as we can see Employee (A) has the latest status is (Accepted) so it is easy to count accepted or rejected " if the status is there)&amp;nbsp;&lt;BR /&gt;on the other hand, Employee (B) Latest status is (Did not attend exam) but doesn't have the (Rejected) status and therefore he won't be included in the count() function.&lt;BR /&gt;&lt;BR /&gt;so my questions is , how to retrieve the latest status for every employee?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;so when i retrieve the status i do my costume calculations on it (EX : if(latest_status = not attend exam, rejected))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 09:16:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989020#M81736</guid>
      <dc:creator>Saif1</dc:creator>
      <dc:date>2022-10-05T09:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the latest status from date per ID</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989028#M81737</link>
      <description>&lt;P&gt;Hi, this should do the trick:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;temp:
LOAD * INLINE [
EMP num,Emp Name,Emp Status,Date
1,A,Sent request,01.09.2022
1,A,Attend Exam,05.09.2022
1,A,Interview,10.09.2022
1,A,Accepted,30.09.2022
2,B,Sent request,10.10.2022
2,B,Did not attend exam,21.10.2022
];

//Custom rules:
[ml_status_adj]:
MAPPING LOAD * INLINE [
From|To
Did not attend exam|Rejected
] (DELIMITER IS '|');

//Latest status:
temp_latest_status:
LOAD DISTINCT
"EMP num",
"Emp Status",
Date
RESIDENT temp;

LEFT JOIN (temp_latest_status)
LOAD
FIELDVALUE('Emp Status',RECNO()) AS "Emp Status",
APPLYMAP('ml_status_adj',FIELDVALUE('Emp Status',RECNO()))	AS "Emp Status Adjusted"
AUTOGENERATE FIELDVALUECOUNT('Emp Status');

INNER JOIN (temp_latest_status)
LOAD
"EMP num",
MAX(Date) AS Date
RESIDENT temp_latest_status
GROUP BY "EMP num";

LEFT JOIN (temp)
LOAD
"EMP num",
"Emp Status Adjusted"	AS "Latest Status"
RESIDENT temp_latest_status;

DROP TABLE temp_latest_status;&lt;/LI-CODE&gt;
&lt;P&gt;and in the frontend:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RsQK_0-1664962930251.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/90609i5059C65ACFDE4F1B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RsQK_0-1664962930251.png" alt="RsQK_0-1664962930251.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 09:42:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989028#M81737</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-10-05T09:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the latest status from date per ID</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989064#M81744</link>
      <description>&lt;P&gt;thank you so much !!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 11:02:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989064#M81744</guid>
      <dc:creator>Saif1</dc:creator>
      <dc:date>2022-10-05T11:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the latest status from date per ID</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989105#M81750</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/164519"&gt;@Saif1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;In UI you can use the below expression:&lt;BR /&gt;if( FirstSortedValue( [Emp Status], -Date) = 'Did not attend exam', 'Rejected', FirstSortedValue( [Emp Status], -Date) )&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 12:49:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-latest-status-from-date-per-ID/m-p/1989105#M81750</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2022-10-05T12:49:45Z</dc:date>
    </item>
  </channel>
</rss>

