Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi Team,
i wanted to compare two date columns coming from two tables
i used TalendDate.compareDate(date1,date2) != 0 as it is returning an integer value this is not expected result
getting null pointer exception in tmap, please help on it.
Regards,
Meena
Hi All,
Now am not getting the error null pointer exception, but am not able to compare date columns properly
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
out.DEV_INT_BIRTH_DATE!= null && row1.DEV_INT_BIRTH_DATE != null ?(TalendDate.compareDate(out.DEV_INT_BIRTH_DATE,row1.DEV_INT_BIRTH_DATE)==0 ?false : true) :true
Regards,
Meena
It depends on if it's a primitive type or not. You have to use Integer.equalsTo(Integer) if its an Integer type. "==" is for a primitive type of int.
Integer.intValue() == 0. In all these cases Integer is your comparison result.
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...
TalendDate.compareDate(out.DEV_INT_BIRTH_DATE,row1.DEV_INT_BIRTH_DATE)==0
....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.
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
@rhall, i have given complete tmap settings
Regards,
Meena
Hi,
Any update on the below request, as it is little urgent
Regards,
Meenas
OK, please consider this as FACT, not fake news. This method will work and take into consideration nulls as well as dates.....
TalendDate.compareDate(out.DEV_INT_BIRTH_DATE,row1.DEV_INT_BIRTH_DATE)==0
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.
If you are getting a nullpointerexception I guarantee that it is NOT to do with this method. This is just confusing the issue.
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.