<?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 Distinct load with updating data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292238#M709773</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; hei &lt;/P&gt;&lt;P&gt;you can use filetime() which give you when the file last modified to sort the files&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Aug 2011 06:33:43 GMT</pubDate>
    <dc:creator>lironbaram</dc:creator>
    <dc:date>2011-08-23T06:33:43Z</dc:date>
    <item>
      <title>Distinct load with updating data</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292237#M709772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My dashboard is currently loading a folder full of monthly Excel reports from a network share. Each row has a numeric identifier that I want to have as unique in the final loaded data. The problem is that there can be multiple occurences of the same ID on later reports where other fields on the same row have been updated. A normal distinct load doesn't work since it only keeps the first corresponding row leaving my data partly out of date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reports' naming convention is Report-YYMM which could maybe be used to identified the load order. The only other thing I can think of is renaming them so that they are loaded from latest to oldest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 06:26:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292237#M709772</guid>
      <dc:creator />
      <dc:date>2011-08-23T06:26:43Z</dc:date>
    </item>
    <item>
      <title>Distinct load with updating data</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292238#M709773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; hei &lt;/P&gt;&lt;P&gt;you can use filetime() which give you when the file last modified to sort the files&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 06:33:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292238#M709773</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2011-08-23T06:33:43Z</dc:date>
    </item>
    <item>
      <title>Distinct load with updating data</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292239#M709774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestion! I'd still have to loop through all of the files in the folder to find the modified date and then load them in the sorted order. I'm not sure how to do that in the load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 09:35:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292239#M709774</guid>
      <dc:creator />
      <dc:date>2011-08-23T09:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct load with updating data</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292240#M709775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the most optimal way is to load excel files looping from newest to oldest, &lt;/P&gt;&lt;P&gt;using "not exists(ID)" to avoid older duplicates.&lt;/P&gt;&lt;P&gt;Here is some script you can try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;// get list of excel files in a directory&lt;/P&gt;&lt;P&gt;set vDirectory = 'E:\SomeDirectory';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for each vFoundFile in filelist(vDirectory &amp;amp; '\*.xls')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Files:&lt;/P&gt;&lt;P&gt; Load&lt;/P&gt;&lt;P&gt; '$(vFoundFile)' as FileName,&lt;/P&gt;&lt;P&gt; FileTime( '$(vFoundFile)' ) as Timestamp&lt;/P&gt;&lt;P&gt; AutoGenerate 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Sort files by timestamp&lt;/P&gt;&lt;P&gt;SortedFiles:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;FileName as FileNameSorted&lt;/P&gt;&lt;P&gt;Resident Files&lt;/P&gt;&lt;P&gt;Order By Timestamp desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Load data from excel files listed in table SortedFiles&lt;/P&gt;&lt;P&gt;for i = 0 to NoOfRows('SortedFiles')-1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; let iExcelFile = Peek('FileNameSorted', i, 'SortedFiles');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Data:&lt;/P&gt;&lt;P&gt; Load&lt;/P&gt;&lt;P&gt; IDField, Field1, Field2&lt;/P&gt;&lt;P&gt; FROM&lt;/P&gt;&lt;P&gt; [$(iExcelFile)] (biff, no labels, table is [SheetName$])&lt;/P&gt;&lt;P&gt; Where not Exists(IDField);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 12:54:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292240#M709775</guid>
      <dc:creator>tanelry</dc:creator>
      <dc:date>2011-08-23T12:54:49Z</dc:date>
    </item>
    <item>
      <title>Distinct load with updating data</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292241#M709776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! That did the the trick after some tweaks. Decided to use the suffix in the filename instead of filetime() since someone might accidentally edit old reports.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 13:51:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-load-with-updating-data/m-p/292241#M709776</guid>
      <dc:creator />
      <dc:date>2011-08-23T13:51:34Z</dc:date>
    </item>
  </channel>
</rss>

