<?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: IF in tJava issue in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337925#M106216</link>
    <description>&lt;P&gt;i think issue with file name format, date format in file name looks like &lt;STRONG&gt;yyMMdd_hhmm&lt;/STRONG&gt; not&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;yyyyMMdd_hhmm&lt;/STRONG&gt; this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please validate file name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 May 2018 15:40:31 GMT</pubDate>
    <dc:creator>vboppudi</dc:creator>
    <dc:date>2018-05-22T15:40:31Z</dc:date>
    <item>
      <title>IF in tJava issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337924#M106215</link>
      <description>&lt;P&gt;Hello everyone, I'm trying to compare filename with date inside to whether or not delete them.&lt;/P&gt; 
&lt;P&gt;Since I have 2 types of filesname : "AA_MAGAS_yyyyMMdd_hhmm" and "AA_BBB_CCC_yyyyMMdd_hhmm" , my idea was to substring the filename (from 9 to 22 for first file type and 11 to 24 for the second one), get the date out &amp;amp; compare it. Then use this result in a run if condition to delete it.&lt;/P&gt; 
&lt;P&gt;My job was working for only 1 file type, but since I tried a IF condition to deal with the 2 filesname, its not working anymore. Can someone have a check ?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;if ( ((String)globalMap.get("tFileList_1_CURRENT_FILE")).equals("AA_MAGAS_*") )

{
	
context.strdate = ((String)globalMap.get("tFileList_1_CURRENT_FILE")).substring(9,22);

context.date = TalendDate.parseDate("yyyyMMdd_hhmm",context.strdate);

//difference of days between current date &amp;amp; file date, &amp;gt;15 = delete (runif)

context.difference = TalendDate.diffDate(TalendDate.getCurrentDate(),context.date,"dd");

}

else {
	

context.ecodate = ((String)globalMap.get("tFileList_1_CURRENT_FILE")).substring(11,24);

context.date = TalendDate.parseDate("yyyyMMdd_hhmm", context.ecodate);

context.difference = TalendDate.diffDate(TalendDate.getCurrentDate(),context.date,"dd");


};&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;My error, seems like the IF condition is not working because the substring get it wrong :&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;java.lang.RuntimeException: java.text.ParseException: Unparseable date: "180210_0345.x"&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 10:22:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337924#M106215</guid>
      <dc:creator>daez</dc:creator>
      <dc:date>2018-05-22T10:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: IF in tJava issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337925#M106216</link>
      <description>&lt;P&gt;i think issue with file name format, date format in file name looks like &lt;STRONG&gt;yyMMdd_hhmm&lt;/STRONG&gt; not&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;yyyyMMdd_hhmm&lt;/STRONG&gt; this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please validate file name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 15:40:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337925#M106216</guid>
      <dc:creator>vboppudi</dc:creator>
      <dc:date>2018-05-22T15:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: IF in tJava issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337926#M106217</link>
      <description>&lt;P&gt;Hello, Thanks its all fine now. We cant use wildcard in equalsIgnoreCase. I had to use substring then equals&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 08:42:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/IF-in-tJava-issue/m-p/2337926#M106217</guid>
      <dc:creator>daez</dc:creator>
      <dc:date>2018-05-23T08:42:37Z</dc:date>
    </item>
  </channel>
</rss>

