a simple test on Talendate, need some java help!

One Star

a simple test on Talendate, need some java help!

Hi,
my question is probably very simple (i am using TOS),
I am using a tmap component, I hava data coming in th component that is a list of people: lastname , firstname, etc (Basic fields). Two columns are dates (datein and dateout) I just want to filter and get only people and compare date are TODAY in
One Star

Re: a simple test on Talendate, need some java help!

(sorry, I posted preview message by error)
So to continue :
I want filter to get ONLY people for whicth datin and dateout are dates in between currentdate, adding a filter like this seems to (almost) work :

(
(TalendDate.compareDate(row1.Datum_in_dienst,TalendDate.getCurrentDate())<=0)
&&
(TalendDate.compareDate(TalendDate.getCurrentDate(),row1.Datum_uit_dienst)<=0)
)
the think is that, sometime, the dateout is not defined (empty or null value, i don't know), in this case, i want to take the data too, who can I test this in java?
Many thanks for any help on this.

Re: a simple test on Talendate, need some java help!

row1.Datum_in_dienst .before(TalendDate.getCurrentDate()) // not inclusive
&&
row1.Datum_uit_dienst.after(TalendDate.getCurrentDate()) // not inclusive
Seven Stars

Re: a simple test on Talendate, need some java help!

That will cause a Null Pointer Exception if row1.Datum_uit_dienst is null. Use
!row1.Datum_in_dienst.after(TalendDate.getCurrentDate())
&& (row1.Datum_uit_dienst==null || !row1.Datum_uit_dienst.before(TalendDate.getCurrentDate()))
(I also used !after and !before to replicate your previous <= conditions.)
One Star

Re: a simple test on Talendate, need some java help!

Thank you !