<?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 Conditional return of datafield in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Conditional-return-of-datafield/m-p/1621134#M595367</link>
    <description>&lt;DIV class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center"&gt;I got a table named "Order", an order has multiple child records in the table "OrderStatus". The orderstatus contains steps following the progress of an order. The orderstatus contains a datetime field holding a timestamp when the specific status was finialized.&lt;/DIV&gt;&lt;DIV class="post-text"&gt;&lt;P&gt;I need to get the datestamp of a specific type of status (say 160) -IF- it exists for the order, otherwise fallback to the date of status 110 (which should always be present).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simple example of the datebase has been set up here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;amp;fiddle=078d09c494bdfd18374bdf81d61d19a5" target="_blank" rel="noopener"&gt;https://dbfiddle.uk/?rdbms=mysql_8.0&amp;amp;fiddle=078d09c494bdfd18374bdf81d61d19a5&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to stackoverflow i did achieve it in sql using the following query:&lt;/P&gt;&lt;P&gt;select o.OrderId, coalesce(loadedTime.Date, pendingTime.Date) AS time_stamp&lt;BR /&gt;from [Order] o&lt;BR /&gt;Join OrderStatus pendingTime&lt;BR /&gt;on pendingTime.OrderId = o.OrderId&lt;BR /&gt;and pendingTime.Type = 110&lt;BR /&gt;Left join OrderStatus loadedTime&lt;BR /&gt;ON loadedTime.OrderId = o.OrderId&lt;BR /&gt;and loadedTime.Type = 160&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 Sep 2019 14:37:43 GMT</pubDate>
    <dc:creator>pdufs40x</dc:creator>
    <dc:date>2019-09-06T14:37:43Z</dc:date>
    <item>
      <title>Conditional return of datafield</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-return-of-datafield/m-p/1621134#M595367</link>
      <description>&lt;DIV class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center"&gt;I got a table named "Order", an order has multiple child records in the table "OrderStatus". The orderstatus contains steps following the progress of an order. The orderstatus contains a datetime field holding a timestamp when the specific status was finialized.&lt;/DIV&gt;&lt;DIV class="post-text"&gt;&lt;P&gt;I need to get the datestamp of a specific type of status (say 160) -IF- it exists for the order, otherwise fallback to the date of status 110 (which should always be present).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simple example of the datebase has been set up here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;amp;fiddle=078d09c494bdfd18374bdf81d61d19a5" target="_blank" rel="noopener"&gt;https://dbfiddle.uk/?rdbms=mysql_8.0&amp;amp;fiddle=078d09c494bdfd18374bdf81d61d19a5&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to stackoverflow i did achieve it in sql using the following query:&lt;/P&gt;&lt;P&gt;select o.OrderId, coalesce(loadedTime.Date, pendingTime.Date) AS time_stamp&lt;BR /&gt;from [Order] o&lt;BR /&gt;Join OrderStatus pendingTime&lt;BR /&gt;on pendingTime.OrderId = o.OrderId&lt;BR /&gt;and pendingTime.Type = 110&lt;BR /&gt;Left join OrderStatus loadedTime&lt;BR /&gt;ON loadedTime.OrderId = o.OrderId&lt;BR /&gt;and loadedTime.Type = 160&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:37:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-return-of-datafield/m-p/1621134#M595367</guid>
      <dc:creator>pdufs40x</dc:creator>
      <dc:date>2019-09-06T14:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional return of datafield</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-return-of-datafield/m-p/1625830#M595368</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Laurent, likely going to need to attach a sample QVW file on this one in order for someone to offer up suggestions, as I am not sure the SQL query is going to be enough for them to sort it in QlikView.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;BR /&gt;Brett&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 14:34:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-return-of-datafield/m-p/1625830#M595368</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-09-19T14:34:41Z</dc:date>
    </item>
  </channel>
</rss>

