<?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 Compare two dates in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352309#M118722</link>
    <description>&lt;P&gt;hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i wanted to compare two date columns coming from two tables&amp;nbsp;&lt;/P&gt;&lt;P&gt;i used TalendDate.compareDate(date1,date2) != 0&amp;nbsp;as it is returning an integer value this is not expected result&lt;/P&gt;&lt;P&gt;getting null pointer exception in tmap, please help on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Meena&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2018 12:03:20 GMT</pubDate>
    <dc:creator>muralam</dc:creator>
    <dc:date>2018-04-05T12:03:20Z</dc:date>
    <item>
      <title>Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352309#M118722</link>
      <description>&lt;P&gt;hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i wanted to compare two date columns coming from two tables&amp;nbsp;&lt;/P&gt;&lt;P&gt;i used TalendDate.compareDate(date1,date2) != 0&amp;nbsp;as it is returning an integer value this is not expected result&lt;/P&gt;&lt;P&gt;getting null pointer exception in tmap, please help on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Meena&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:03:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352309#M118722</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-05T12:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352310#M118723</link>
      <description>&lt;P&gt;What is the expected result?&amp;nbsp;Can you show me the tMap settings?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 13:16:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352310#M118723</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T13:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352311#M118724</link>
      <description>i need result like dd-MM-yyyy formate&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Apr 2018 13:56:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352311#M118724</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-05T13:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352312#M118725</link>
      <description>In tmap output side filter, i gave like&lt;BR /&gt;TalendDate.compareDate(row1.date1,row2.date2) != 0&lt;BR /&gt;if result is equal i should not load anything&lt;BR /&gt;if result not equal i should load row2.date2&lt;BR /&gt;date1 nulls are expected, am comparing null=date2, i feel that can be the reason am getting null pointer exception in tmap, but could not able to solve it its very urgent i need to complete this asap</description>
      <pubDate>Thu, 05 Apr 2018 14:02:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352312#M118725</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-05T14:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352313#M118726</link>
      <description>&lt;P&gt;OK, in your tMap filter you need.....&lt;/P&gt;&lt;PRE&gt;TalendDate.compareDate(row1.date1,row2.date2) != 0&lt;/PRE&gt;&lt;P&gt;.....the nulls are handled by the routine method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing that your tMap output schema has the date column set to not nullable. I suspect that&amp;nbsp;&lt;SPAN&gt;row2.date2 is null when it fails. However I will need to see the tMap config to tell if this is true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 14:18:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352313#M118726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T14:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352314#M118727</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LLWmAAO"&gt;@muralam&lt;/A&gt;,first handale the nulls for bothe dates and comprare so that you will not get null pointer exception.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 14:45:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352314#M118727</guid>
      <dc:creator>manodwhb</dc:creator>
      <dc:date>2018-04-05T14:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352315#M118728</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKmJAAW"&gt;@manodwhb&lt;/A&gt;&amp;nbsp;nulls are handled by the method.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;    /**
     * compare two date
     *
     * @param date1 (first date)
     * @param date2 (second date)
     * @param pattern (compare specified part, example: "yyyy-MM-dd")
     * @return the result wheather two date is the same, if first one less than second one return number -1, equlas
     * return number 0, bigger than return number 1. (can compare partly)
     *
     * {talendTypes} Integer
     *
     * {Category} TalendDate
     *
     * {param} date(myDate) date1 : the first date to compare
     *
     * {param} date(myDate2) date2 : the second date to compare
     *
     * {param} String("yyyy-MM-dd") pattern : compare specified part
     *
     * {examples}
     *
     * -&amp;gt;&amp;gt; compareDate(2008/11/24 12:15:25, 2008/11/24 16:10:35) return -1
     *
     * -&amp;gt;&amp;gt; compareDate(2008/11/24 16:10:35, 2008/11/24 12:15:25) return 1
     *
     * -&amp;gt;&amp;gt; compareDate(2008/11/24 12:15:25, 2008/11/24 16:10:35,"yyyy/MM/dd") return 0 #
     */
    public static int compareDate(Date date1, Date date2, String pattern) {
        if (date1 == null &amp;amp;&amp;amp; date2 == null) {
            return 0;
        } else if (date1 != null &amp;amp;&amp;amp; date2 == null) {
            return 1;
        } else if (date1 == null &amp;amp;&amp;amp; date2 != null) {
            return -1;
        }

        if (pattern != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(pattern);
            String part1 = sdf.format(date1), part2 = sdf.format(date2);
            return (part1.compareTo(part2) &amp;gt;= 1 ? 1 : (part1.compareTo(part2) &amp;lt;= -1 ? -1 : 0));
        } else {
            long time1 = date1.getTime(), time2 = date2.getTime();
            return (time1 &amp;lt; time2 ? -1 : (time1 == time2 ? 0 : 1));
        }
    }&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2018 15:09:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352315#M118728</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T15:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352316#M118729</link>
      <description>&lt;P&gt;yes&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;,then he shoul dnot get null pointer exception in tmap while comparing.it coud be other filed that he needs to handle nulls in tmap.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 15:12:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352316#M118729</guid>
      <dc:creator>manodwhb</dc:creator>
      <dc:date>2018-04-05T15:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352317#M118730</link>
      <description>Yes both date columns are nullable column I am trying to compare null with date value</description>
      <pubDate>Thu, 05 Apr 2018 15:36:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352317#M118730</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-05T15:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352318#M118731</link>
      <description>&lt;P&gt;Can you send us the complete nullpointerexception error?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 15:48:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352318#M118731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T15:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352319#M118732</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;Now am not getting the error null pointer exception, but am not able to compare date columns properly&lt;/P&gt;
&lt;P&gt;i have written the logic as below, the attached screen shot, am comparing two tables on below date columns which can be null, if result set is false like null!=datevalue i have to update my target table with date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;out.DEV_INT_BIRTH_DATE!= null &amp;amp;&amp;amp; row1.DEV_INT_BIRTH_DATE != null ?(TalendDate.compareDate(out.DEV_INT_BIRTH_DATE,row1.DEV_INT_BIRTH_DATE)==0 ?false : true) :true&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Meena&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LrWY"&gt;Capture.PNG&lt;/A&gt;</description>
      <pubDate>Thu, 05 Apr 2018 19:04:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352319#M118732</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-05T19:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352320#M118733</link>
      <description>&lt;P&gt;It depends on if it's a primitive type or&amp;nbsp;not. You have to use&amp;nbsp;Integer.equalsTo(Integer) if its an Integer type. "==" is for a primitive type of int.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 19:33:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352320#M118733</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T19:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352321#M118734</link>
      <description>&lt;P&gt;Integer.intValue() == 0. In all these cases Integer is your comparison result.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 19:35:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352321#M118734</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T19:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352322#M118735</link>
      <description>But these are date columns I didn't get your input compare integer&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Apr 2018 20:26:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352322#M118735</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-05T20:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352323#M118736</link>
      <description>&lt;P&gt;Can you show your whole tMap please? I believe your problem is with your configuration, but I can't tell unless I can see your whole tMap. By the way, there is no need for you to write the code you have included above. This code...&lt;/P&gt; 
&lt;PRE&gt;TalendDate.compareDate(out.DEV_INT_BIRTH_DATE,row1.DEV_INT_BIRTH_DATE)==0&lt;/PRE&gt; 
&lt;P&gt;....will return true if the columns match (even if both are null....which is possibly where your problem arrises) or false if they do not. Nulls are handled here. This is all you require for your logic as to whether an update is required. If you can read Java, take a look at the routine yourself. I have posted the code in a message above.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 22:15:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352323#M118736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T22:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352324#M118737</link>
      <description>&lt;A href="https://community.qlik.com/s/profile/null"&gt;@rhall&lt;/A&gt; 
&lt;BR /&gt;yes i have to handle nulls, may be i have to compare 
&lt;BR /&gt;null=datevalue 
&lt;BR /&gt;null=null 
&lt;BR /&gt;null=empty, when i compare as these are nullable columns, nulls are expected, which i am not getting the result as expected, 
&lt;BR /&gt;my expected result i wanted to compare null=date load date value, null=null,null=emptyfield load nothing pass null, finally i wanted to pass data when there is a date value or else null, kindly help me out. 
&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Apr 2018 03:03:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352324#M118737</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-06T03:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352325#M118738</link>
      <description>&lt;P&gt;The same above mentioned scenario i am able to load data in case of strings where i have written a small routine to compare the required columns to find updates&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;, i have given complete tmap settings&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards,&lt;/P&gt; 
&lt;P&gt;Meena&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LsWv"&gt;tmap settings.PNG&lt;/A&gt;</description>
      <pubDate>Fri, 06 Apr 2018 03:26:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352325#M118738</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-06T03:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352326#M118739</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any update on the below request, as it is little urgent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Meenas&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 07:58:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352326#M118739</guid>
      <dc:creator>muralam</dc:creator>
      <dc:date>2018-04-06T07:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352327#M118740</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LLWmAAO"&gt;@muralam&lt;/A&gt;,please findthe attahced smaple job to compare dates.&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LsJK"&gt;test_date.zip&lt;/A&gt;</description>
      <pubDate>Fri, 06 Apr 2018 08:27:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352327#M118740</guid>
      <dc:creator>manodwhb</dc:creator>
      <dc:date>2018-04-06T08:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two dates</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352328#M118741</link>
      <description>&lt;P&gt;OK, please consider this as FACT, not fake news. This method will work and take into consideration nulls as well as dates.....&lt;/P&gt; 
&lt;PRE&gt;TalendDate.compareDate(out.DEV_INT_BIRTH_DATE,row1.DEV_INT_BIRTH_DATE)==0&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;So, if your values are null and null, it will return 0. If your dates are the same (down to the millisecond) it will return 0. If your dates are different or one is a null, then it will return either 1 or -1 depending on which date is null or greater.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;If you are getting a nullpointerexception I guarantee that it is NOT to do with this method. This is just confusing the issue.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can you please take a screenshot of your whole tMap. NOT small sections. I need to see ALL of it. Can you also add a tLogRow before the tMap (for both inputs, Main and Lookup) and post the data here so that we can see what is going into your tMap? You will also get an error message with the nullpointerexception. Can you post the exact error.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 09:28:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-two-dates/m-p/2352328#M118741</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-06T09:28:48Z</dc:date>
    </item>
  </channel>
</rss>

