<?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: Loading  two tables only if they share the same date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780496#M717475</link>
    <description>&lt;P&gt;I'm not sure that there is really an easy way to detect the latest common file respectively date from all folders (it's a comparing of two arrays). Here a method which could work in Qlik (could means it's just written down without any testing and you may need some adjustments here and there):&lt;/P&gt;&lt;P&gt;for each folder in '1', '2'&lt;BR /&gt;&amp;nbsp; &amp;nbsp;for each file in filelist('C:\...\folder$(folder)\*.xls')&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let vDateOrigin = keepchar(subfield('$(file)', '\', -1), '0123456789'));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let vDateAdjusted = date(date#(keepchar(subfield('$(file)', '\', -1), '0123456789')), 'DDMMYYYY'));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t1: load $(vDateOrigin) as F1, &amp;nbsp;'$(vDateAdjusted)' as F2, $(folder) as F3 autogenerate 1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;next&lt;BR /&gt;next&lt;/P&gt;&lt;P&gt;t2: load F1, F2 resident t1 where F3 = 1; inner join(t2) load F1, F2 resident t1 where F3 = 2;&lt;BR /&gt;t3: load date(max(F2)) as F2max resident t2;&lt;/P&gt;&lt;P&gt;let vFinalFile = fieldvalue('F1', fieldindex('F2', peek('F2max', 0', 't3'));&lt;BR /&gt;drop tables t1, t2, t3; let vDateOrigin = null(); let vDateAdjusted = null();&lt;/P&gt;&lt;P&gt;t1: load * from [C:\...\folder1\*$(vFinalFile).xls] (biff, …);&lt;BR /&gt;t2: load * from [C:\...\folder2\*$(vFinalFile).xls] (biff, …);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- Marcus&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2021 11:07:47 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2021-02-05T11:07:47Z</dc:date>
    <item>
      <title>Loading  two tables only if they share the same date</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780241#M717474</link>
      <description>&lt;P&gt;Hello every one ,&lt;/P&gt;&lt;P&gt;I'm facing this problem, i have two folders each contains different excels workbooks like :&lt;/P&gt;&lt;P&gt;Folder1 :&lt;BR /&gt;C:\Users\acer\Desktop\Folder1\ProductionPlan02022021.xls&lt;BR /&gt;C:\Users\acer\Desktop\Folder1\ProductionPlan03022021.xls&lt;BR /&gt;C:\Users\acer\Desktop\Folder1\ProductionPlan04022021.xls&lt;/P&gt;&lt;P&gt;Folder2:&lt;BR /&gt;C:\Users\acer\Desktop\Folder2\Demand01022021.xls&lt;BR /&gt;C:\Users\acer\Desktop\Folder2\Demand02022021.xls&lt;/P&gt;&lt;P&gt;I'm trying to find a way to load the latest files of each folder sharing the same date in this case it's 02/02/2021.&lt;/P&gt;&lt;P&gt;I used FileTime function and i can easily get the latest file of each folder however i couldn't find a way to search in both paths any ideas ?&lt;/P&gt;&lt;P&gt;Thank you so much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:17:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780241#M717474</guid>
      <dc:creator>WalidChoukri</dc:creator>
      <dc:date>2021-02-04T15:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Loading  two tables only if they share the same date</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780496#M717475</link>
      <description>&lt;P&gt;I'm not sure that there is really an easy way to detect the latest common file respectively date from all folders (it's a comparing of two arrays). Here a method which could work in Qlik (could means it's just written down without any testing and you may need some adjustments here and there):&lt;/P&gt;&lt;P&gt;for each folder in '1', '2'&lt;BR /&gt;&amp;nbsp; &amp;nbsp;for each file in filelist('C:\...\folder$(folder)\*.xls')&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let vDateOrigin = keepchar(subfield('$(file)', '\', -1), '0123456789'));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let vDateAdjusted = date(date#(keepchar(subfield('$(file)', '\', -1), '0123456789')), 'DDMMYYYY'));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t1: load $(vDateOrigin) as F1, &amp;nbsp;'$(vDateAdjusted)' as F2, $(folder) as F3 autogenerate 1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;next&lt;BR /&gt;next&lt;/P&gt;&lt;P&gt;t2: load F1, F2 resident t1 where F3 = 1; inner join(t2) load F1, F2 resident t1 where F3 = 2;&lt;BR /&gt;t3: load date(max(F2)) as F2max resident t2;&lt;/P&gt;&lt;P&gt;let vFinalFile = fieldvalue('F1', fieldindex('F2', peek('F2max', 0', 't3'));&lt;BR /&gt;drop tables t1, t2, t3; let vDateOrigin = null(); let vDateAdjusted = null();&lt;/P&gt;&lt;P&gt;t1: load * from [C:\...\folder1\*$(vFinalFile).xls] (biff, …);&lt;BR /&gt;t2: load * from [C:\...\folder2\*$(vFinalFile).xls] (biff, …);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- Marcus&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 11:07:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780496#M717475</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-02-05T11:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Loading  two tables only if they share the same date</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780796#M984643</link>
      <description>&lt;P&gt;Thank you so much for your reply, I did something similar and it works mainly storing the common dates using subfield(to extract the date from the filename) and lookup(to get the common dates) in a table then order by to get the first sorted value with the most recent date.&lt;/P&gt;&lt;P&gt;Again Thank you Marcus.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 09:05:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-two-tables-only-if-they-share-the-same-date/m-p/1780796#M984643</guid>
      <dc:creator>WalidChoukri</dc:creator>
      <dc:date>2021-02-08T09:05:10Z</dc:date>
    </item>
  </channel>
</rss>

