<?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 Testing for Date Value in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Testing-for-Date-Value/m-p/2248885#M33590</link>
    <description>This should be really simple, however this does appears not to be the case in java&lt;BR /&gt;I am trying to filter for "null" date values from SQLServer which appear as '1753-01-01'&lt;BR /&gt;eg:&lt;BR /&gt;(row1.Initial_Action_Completed_Date=="1753-01-01")?"":&lt;BR /&gt;TalendDate.formatDate("dd/MM/yyyy",row1.Initial_Action_Completed_Date)&lt;BR /&gt;This fails as follows "Incompatible operand types date and String"&lt;BR /&gt;If I try any formats within the test I get errors relating to talend workspace&lt;BR /&gt;eg: &lt;BR /&gt;(formatDate("yyyy-MM-dd",row1.Initial_Action_Completed_Date)=="1753-01-01")?"":&lt;BR /&gt;TalendDate.formatDate("dd/MM/yyyy",row1.Initial_Action_Completed_Date)&lt;BR /&gt;I get&lt;BR /&gt;"the method is undefined for the type TalendJavaSourceViewer"&lt;BR /&gt;So before I just write a nice simple SQL function and curse java is there any reasonable simple solution to this</description>
    <pubDate>Wed, 15 Aug 2012 16:32:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-08-15T16:32:48Z</dc:date>
    <item>
      <title>Testing for Date Value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Testing-for-Date-Value/m-p/2248885#M33590</link>
      <description>This should be really simple, however this does appears not to be the case in java&lt;BR /&gt;I am trying to filter for "null" date values from SQLServer which appear as '1753-01-01'&lt;BR /&gt;eg:&lt;BR /&gt;(row1.Initial_Action_Completed_Date=="1753-01-01")?"":&lt;BR /&gt;TalendDate.formatDate("dd/MM/yyyy",row1.Initial_Action_Completed_Date)&lt;BR /&gt;This fails as follows "Incompatible operand types date and String"&lt;BR /&gt;If I try any formats within the test I get errors relating to talend workspace&lt;BR /&gt;eg: &lt;BR /&gt;(formatDate("yyyy-MM-dd",row1.Initial_Action_Completed_Date)=="1753-01-01")?"":&lt;BR /&gt;TalendDate.formatDate("dd/MM/yyyy",row1.Initial_Action_Completed_Date)&lt;BR /&gt;I get&lt;BR /&gt;"the method is undefined for the type TalendJavaSourceViewer"&lt;BR /&gt;So before I just write a nice simple SQL function and curse java is there any reasonable simple solution to this</description>
      <pubDate>Wed, 15 Aug 2012 16:32:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Testing-for-Date-Value/m-p/2248885#M33590</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T16:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Testing for Date Value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Testing-for-Date-Value/m-p/2248886#M33591</link>
      <description>The error "Incompatible operand types date and String" is because row1.Initial_Action_Completed_Date is a Date while "1753-01-01" is a String, so they can't be compared. Comparisons need to be made between objects of the same type.
&lt;BR /&gt;I think the error "the method is undefined for the type TalendJavaSourceViewer" is because you're missing the "TalendDate." part in the condition.
&lt;BR /&gt;Also, you should not compare objects using == but the .equals or .compareTo methods instead.
&lt;BR /&gt;So you need either:
&lt;BR /&gt;row1.Initial_Action_Completed_Date.equals(TalendDate.parseDate("yyyy-MM-dd","1753-01-01"))?"":
&lt;BR /&gt;TalendDate.formatDate("dd/MM/yyyy",row1.Initial_Action_Completed_Date)
&lt;BR /&gt;or
&lt;BR /&gt;TalendDate.formatDate("yyyy-MM-dd",row1.Initial_Action_Completed_Date).equals("1753-01-01")?"":
&lt;BR /&gt;TalendDate.formatDate("dd/MM/yyyy",row1.Initial_Action_Completed_Date)</description>
      <pubDate>Thu, 16 Aug 2012 02:44:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Testing-for-Date-Value/m-p/2248886#M33591</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-08-16T02:44:36Z</dc:date>
    </item>
  </channel>
</rss>

