<?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 fetch files from directories based on dates in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304751#M76488</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;lennelei and TRF for the response.&lt;/P&gt;&lt;P&gt;But can you please let me know which all components should be used to achieve this scenario. When I am using Run If link after tFileList then it is not traversing/Iterating to all the subdirectories. And if I use Iterate link after tFileList then i am not able to compare the start_dt and end_Dt with the subdirectories.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me out.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2019 07:08:18 GMT</pubDate>
    <dc:creator>shameer1</dc:creator>
    <dc:date>2019-06-27T07:08:18Z</dc:date>
    <item>
      <title>How to fetch files from directories based on dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304748#M76485</link>
      <description>&lt;P&gt;Suppose I have few files in few directories as below.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;/home/2019-06-23/test1.txt&lt;BR /&gt;/home/2019-06-23/test2.txt&lt;BR /&gt;/home/2019-06-24/test1.txt&lt;BR /&gt;/home/2019-06-24/test2.txt&lt;BR /&gt;/home/2019-06-25/test1.txt&lt;BR /&gt;/home/2019-06-25/test2.txt&lt;/P&gt; 
&lt;P&gt;/home/2019-06-26/test1.txt&lt;BR /&gt;/home/2019-06-26/test2.txt&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;My requirement is&amp;nbsp; to fetch the files from those directory as per the two argument at run time i.e start_Dt and end_Dt.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;If I pass Start_dt =2019-06-23 and end_Dt =2019-06-25 in my context variable then I should be fetching the below files only(from directory falling between the dates&amp;nbsp; 2019-06-23 and 2019-06-25) and I need to append their context in one output file out.txt&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;/home/2019-06-23/test1.txt&lt;BR /&gt;/home/2019-06-23/test2.txt&lt;BR /&gt;/home/2019-06-24/test1.txt&lt;BR /&gt;/home/2019-06-24/test2.txt&lt;/P&gt; 
&lt;P&gt;/home/2019-06-25/test1.txt&lt;BR /&gt;/home/2019-06-25/test2.txt&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;How can i implement this in talend. I tried to use tLoop, but it seems to only work with number (like i=0;i&amp;lt;10;i++) and not with dates.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:28:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304748#M76485</guid>
      <dc:creator>shameer1</dc:creator>
      <dc:date>2024-11-16T05:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch files from directories based on dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304749#M76486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;number can be seen as the difference between two dates, therefore, you can use the tLoop in order to count the number of days between both dates for example.&lt;/P&gt; 
&lt;PRE&gt;for&amp;nbsp;i=0 ; i&amp;lt;(date_end - date_start) days ; i++&lt;/PRE&gt; 
&lt;P&gt;you can use TalendDate routine to compute the number of days in the tLoop parameters :&lt;/P&gt; 
&lt;PRE&gt;From : 0&lt;BR /&gt;To : TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd", "2019-06-25"),TalendDate.parseDate("yyyy-MM-dd", "2019-06-23"),"dd")&lt;BR /&gt;Step : 1&lt;/PRE&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20190626_085053_104.png" style="width: 837px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M5j9.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130840i9C649B5E3C81503F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M5j9.png" alt="0683p000009M5j9.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;After that, you can use the CURRENT_VALUE from the tLoop to compute the date corresponding to the current loop :&lt;/P&gt; 
&lt;PRE&gt;TalendDate.addDate(TalendDate.parseDate("yyyy-MM-dd", "2019-06-23"), ((Integer)globalMap.get("tLoop_1_CURRENT_VALUE")), "dd")&lt;/PRE&gt; 
&lt;P&gt;Of course, you should set global variables to store the start and end dates; and you will have to format the date according to your folders format.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;But personnaly, I would use the tLoop as a "while" loop :&lt;/P&gt; 
&lt;PRE&gt;Declaration : globalMap.put("moment", TalendDate.parseDate("yyyy-MM-dd", "2019-06-23"))
Condition : ((Date)globalMap.get("moment")).before(TalendDate.parseDate("yyyy-MM-dd", "2019-06-26"))
Iteration : globalMap.put("moment", TalendDate.addDate((Date)globalMap.get("moment"),1,"dd"))&lt;/PRE&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20190626_085109_587.png" style="width: 837px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M5jE.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133563i165DBAAD22FF5258/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M5jE.png" alt="0683p000009M5jE.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Which is nice here is that you can simply use the global variable "moment" to access the current date :&lt;/P&gt; 
&lt;PRE&gt;TalendDate.formatDate("yyyy-MM-dd", (Date)globalMap.get("moment"))&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 07:55:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304749#M76486</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-06-26T07:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch files from directories based on dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304750#M76487</link>
      <description>&lt;P&gt;You can do it with just a tFileList to scan the /home content.&lt;/P&gt;&lt;P&gt;Then as folder names are well formed, you can use String.compareTo method to compare &lt;SPAN&gt;lexicographically&amp;nbsp;&lt;/SPAN&gt;each names with your context variables.&lt;/P&gt;&lt;P&gt;No need to deal with dates convertions in your case.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 08:03:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304750#M76487</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2019-06-26T08:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch files from directories based on dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304751#M76488</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;lennelei and TRF for the response.&lt;/P&gt;&lt;P&gt;But can you please let me know which all components should be used to achieve this scenario. When I am using Run If link after tFileList then it is not traversing/Iterating to all the subdirectories. And if I use Iterate link after tFileList then i am not able to compare the start_dt and end_Dt with the subdirectories.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me out.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 07:08:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304751#M76488</guid>
      <dc:creator>shameer1</dc:creator>
      <dc:date>2019-06-27T07:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch files from directories based on dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304752#M76489</link>
      <description>&lt;P&gt;In a ESB route, Camel has seeded parameters to read files per date, see Camel File2 doc.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 10:22:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304752#M76489</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2019-07-04T10:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to fetch files from directories based on dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304753#M76490</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;tLoop --(iterate)--&amp;gt; tFileList --(iterate)--&amp;gt; [whatever you want to do with your files]&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 09 Jul 2019 17:18:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-fetch-files-from-directories-based-on-dates/m-p/2304753#M76490</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-09T17:18:19Z</dc:date>
    </item>
  </channel>
</rss>

