<?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: [resolved] get date from file name in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290899#M64136</link>
    <description>Try this.....&lt;BR /&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/FONT&gt;&lt;/FONT&gt;.substring(&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/FONT&gt;&lt;/FONT&gt;.indexOf(".txt")-6,&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/FONT&gt;&lt;/FONT&gt;.indexOf(".txt"))&amp;nbsp;</description>
    <pubDate>Wed, 27 Apr 2016 20:35:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-04-27T20:35:13Z</dc:date>
    <item>
      <title>[resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290891#M64128</link>
      <description>Hi,
&lt;BR /&gt;I am unable to get Date from a file name to use in tmap expression editor.
&lt;BR /&gt;Attached is my Job design and tMap editor view.&amp;nbsp;
&lt;BR /&gt;1) The tFileRowCount input file name is like "Data_f.cat.fy16.detail.201602.txt". Now I need to read the date part which is "201602" in this case (YYYYMM) and pass it to the "ExtractDate" expression in the tMap expression editor on&amp;nbsp;the output file. For now I've hardcoded&amp;nbsp;"ExtractDate=201602" as you can see in the attached image, but as per the requirement it should read the date from the actual date file name, which is given as input for tFileRowCount in the current job.
&lt;BR /&gt;2) Is there any way to achieve with and/or without tJava related components
&lt;BR /&gt;Let me know if I am not very clear about the requirement.
&lt;BR /&gt;thank you for your time.</description>
      <pubDate>Tue, 26 Apr 2016 23:09:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290891#M64128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-26T23:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290892#M64129</link>
      <description>attaching file again</description>
      <pubDate>Tue, 26 Apr 2016 23:16:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290892#M64129</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-26T23:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290893#M64130</link>
      <description>Since you do not know the filename, I am assuming that you are using the tFileList component to pass the filename to the component you are using to read it. If you aren't, then you probably should be. If you tFileList is called tFileList_1, the way to get the filename is to use this code....
&lt;BR /&gt;
&lt;PRE&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/PRE&gt;
&lt;BR /&gt;You can use that in a tMap and use a regex to get the date from the filename.</description>
      <pubDate>Wed, 27 Apr 2016 00:49:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290893#M64130</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T00:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290894#M64131</link>
      <description>Hi, thank you for quick reply. 
&lt;BR /&gt;I've already managed to get the file name&amp;nbsp;using tFileList. But what I could not figure out was how to get only date (201602) from 
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;"Data_f.cat.fy16.detail.201602.txt"&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;and use it in tMap 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MPcz.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157233iD1A564EF62DE3BC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MPcz.png" alt="0683p000009MPcz.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Wed, 27 Apr 2016 01:16:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290894#M64131</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T01:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290895#M64132</link>
      <description>You can use Java String functions "substring" and "indexOf" to do this. You know that the date comes just before ".txt" and you know it is 6 characters. That is all you need.</description>
      <pubDate>Wed, 27 Apr 2016 01:48:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290895#M64132</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T01:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290896#M64133</link>
      <description>Hi .. 
&lt;BR /&gt;I have used the java string function as below, to get the date from the file name " 
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Data_f.cat.fy16.detail.201602.txt&lt;/FONT&gt;&lt;/FONT&gt;" : 
&lt;BR /&gt;"ExtractDate="+(((String)globalMap.get("tFileList_1_CURRENT_FILE")).substring(23,((String)globalMap.get("tFileList_1_CURRENT_FILE")).indexOf(".txt"))) 
&lt;BR /&gt;I've used 23 as that is the number of characters before 201602 in the file name, and then I got the output as desired which is ExtractDate=201602. 
&lt;BR /&gt;but, what if the number of characters before the date in the filename changes or varies? 
&lt;BR /&gt;PS: Sorry, I'm not from core development / programming background.</description>
      <pubDate>Wed, 27 Apr 2016 03:29:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290896#M64133</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T03:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290897#M64134</link>
      <description>You use "indexOf" to work out where the ".txt" is in the String. Then you know that the start of your date is 6 characters before that position. You then have your beginning and end position.</description>
      <pubDate>Wed, 27 Apr 2016 10:17:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290897#M64134</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T10:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290898#M64135</link>
      <description>I might sound too dumb but .. 
&lt;BR /&gt;what do I pass instead of 23? how do I tell to get last 6 digits (before .txt) instead of telling to ignore first 23 characters?</description>
      <pubDate>Wed, 27 Apr 2016 20:22:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290898#M64135</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T20:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290899#M64136</link>
      <description>Try this.....&lt;BR /&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/FONT&gt;&lt;/FONT&gt;.substring(&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/FONT&gt;&lt;/FONT&gt;.indexOf(".txt")-6,&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;((String)globalMap.get("tFileList_1_CURRENT_FILE"))&lt;/FONT&gt;&lt;/FONT&gt;.indexOf(".txt"))&amp;nbsp;</description>
      <pubDate>Wed, 27 Apr 2016 20:35:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290899#M64136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T20:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290900#M64137</link>
      <description>thank you very much .. it looks complete now .. Got It 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;where can I learn or what key words shall I use to search google .. to learn similar java (or string or any other) related functions to use in Talend .. not to learn complete Java. 
&lt;BR /&gt;thanks again 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Wed, 27 Apr 2016 20:47:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290900#M64137</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T20:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290901#M64138</link>
      <description>Learning Java is a must for Talend when you want to see what Talend can really do. But even the smallest things make use of simple Java concepts. Look for some Java tutorials online and download a copy of Eclipse (or similar). Once you have got a few examples under your belt, you will start to understand a bit more to ask (Google) the right questions. A lot of people (at University and other places) use a book called "Objects First with BlueJ" ( 
&lt;A href="http://www.bluej.org/objects-first/" rel="nofollow noopener noreferrer"&gt;http://www.bluej.org/objects-first/&lt;/A&gt;).</description>
      <pubDate>Wed, 27 Apr 2016 20:55:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290901#M64138</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T20:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] get date from file name</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290902#M64139</link>
      <description>thank you .. i'll start learning Java for sure.&amp;nbsp;</description>
      <pubDate>Wed, 27 Apr 2016 21:46:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-get-date-from-file-name/m-p/2290902#M64139</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-27T21:46:42Z</dc:date>
    </item>
  </channel>
</rss>

