<?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 Min Date from QVD FileBaseName in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267514#M399132</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would like to define 2 variable based on the dates at the end of the qvds below. &lt;BR /&gt;I am trying to define&lt;/P&gt;&lt;P&gt;vMinDate&lt;/P&gt;&lt;P&gt;Let vSpin =&amp;nbsp; $(vMinDate) to Today() -1&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;How to arrive at the min date in this case for QVD1 and QVD2?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Location:&amp;nbsp; D:\&lt;BR /&gt;QVD1_20170131&lt;BR /&gt;QVD1_20170201&lt;BR /&gt;QVD1_20170115&lt;BR /&gt;QVD1_20170116&lt;BR /&gt;QVD1_20170117&lt;BR /&gt;QVD1_20170118&lt;BR /&gt;QVD2_20170131&lt;BR /&gt;QVD2_20170201&lt;BR /&gt;QVD2_20170115&lt;BR /&gt;QVD2_20170116&lt;BR /&gt;QVD2_20170117&lt;BR /&gt;QVD2_20170118&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Feb 2017 06:03:04 GMT</pubDate>
    <dc:creator>didierodayo</dc:creator>
    <dc:date>2017-02-27T06:03:04Z</dc:date>
    <item>
      <title>Min Date from QVD FileBaseName</title>
      <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267514#M399132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would like to define 2 variable based on the dates at the end of the qvds below. &lt;BR /&gt;I am trying to define&lt;/P&gt;&lt;P&gt;vMinDate&lt;/P&gt;&lt;P&gt;Let vSpin =&amp;nbsp; $(vMinDate) to Today() -1&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;How to arrive at the min date in this case for QVD1 and QVD2?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Location:&amp;nbsp; D:\&lt;BR /&gt;QVD1_20170131&lt;BR /&gt;QVD1_20170201&lt;BR /&gt;QVD1_20170115&lt;BR /&gt;QVD1_20170116&lt;BR /&gt;QVD1_20170117&lt;BR /&gt;QVD1_20170118&lt;BR /&gt;QVD2_20170131&lt;BR /&gt;QVD2_20170201&lt;BR /&gt;QVD2_20170115&lt;BR /&gt;QVD2_20170116&lt;BR /&gt;QVD2_20170117&lt;BR /&gt;QVD2_20170118&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2017 06:03:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267514#M399132</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-02-27T06:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Min Date from QVD FileBaseName</title>
      <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267515#M399133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you describe more? What was the intention you want to load / Save. I am sure you may need Min of Qvd1 &amp;amp; Qvd2. But not understand 100%&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2017 06:21:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267515#M399133</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-02-27T06:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Min Date from QVD FileBaseName</title>
      <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267516#M399134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;check this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/89640"&gt;Load file based on timestamp&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2017 06:27:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267516#M399134</guid>
      <dc:creator>ajsjoshua</dc:creator>
      <dc:date>2017-02-27T06:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Min Date from QVD FileBaseName</title>
      <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267517#M399135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Didier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that you are doing great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer below given sample script:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14881769580323325 jive_text_macro" jivemacro_uid="_14881769580323325"&gt;
&lt;P&gt;//Get the distinct file names&lt;/P&gt;
&lt;P&gt;FileDemo:&lt;/P&gt;
&lt;P&gt;LOAD DISTINCT&lt;/P&gt;
&lt;P&gt;FileBaseName() AS MyFileName&lt;/P&gt;
&lt;P&gt;FROM&lt;/P&gt;
&lt;P&gt;Data\*.txt&lt;/P&gt;
&lt;P&gt;(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;//Get the min. date for every QVD&lt;/P&gt;
&lt;P&gt;FinalList:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;Left(MyFileName, Index(MyFileName,'_')-1) AS QVD,&lt;/P&gt;
&lt;P&gt;Min(Right(MyFileName, Len(MyFileName) - Index(MyFileName,'_'))) AS Date&lt;/P&gt;
&lt;P&gt;Resident FileDemo&lt;/P&gt;
&lt;P&gt;Group By Left(MyFileName, Index(MyFileName,'_')-1);&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can refer the FinalList Table to get the QVD name and Min. Date by using Peek function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;P.S.: Instead of writing Left &amp;amp; Right function you can make use of SubField function. &lt;/EM&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;&lt;EM&gt;Left&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2017 06:32:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267517#M399135</guid>
      <dc:creator>rahulpawarb</dc:creator>
      <dc:date>2017-02-27T06:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Min Date from QVD FileBaseName</title>
      <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267518#M399136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I want to read from those qvds every morning and store back into a different location.&lt;/P&gt;&lt;P&gt;I want to store with the same name but I don't to repeat what I have already saved unless the file is missing for any reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am thinkingof checking the min date and ensure I generate new qvds from the min date where the qvd is not already generated.thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2017 06:37:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267518#M399136</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-02-27T06:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Min Date from QVD FileBaseName</title>
      <link>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267519#M399137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some code like this will set vMinDate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vMinDate = Today();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For Each vFile in FileList('D:\QVD*.qvd')&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Let vDate = Right(SubField(vFile, '.', 1), 8);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Let vMinDate = RangeMin(vDate, vMinDate);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Next&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;To harden this code against the case that not all files conform to the nameing rules, use&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; Let vDate = Alt(Right(SubField(vFile, '.', 1), 8), Today());&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2017 07:09:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-Date-from-QVD-FileBaseName/m-p/1267519#M399137</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2017-02-27T07:09:22Z</dc:date>
    </item>
  </channel>
</rss>

