Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
just maybe somebody meets with similar case:
Source structure:
Next tMap code, works as expected:
row1.event.equals("TEXT")? null :row1.validAfter==null? null :Long.valueOf(TalendDate.formatDate("yyyyMMddHH",row1.validAfter) )
but similar extended construction:
row1.event.equals("TEXT")? null :row1.isPermanent==1L? -1L :row1.validUntil==null? null :Long.valueOf(TalendDate.formatDate("yyyyMMddHH",row1.validUntil) )
not!
each part of wrong code work fine, and current solution -
replaced by SQL CASE at source for validUntil:
row1.event.equals("TEXT")? null
tMap for out.validUntil_Long
row1.validUntil==null? null :Long.valueOf(TalendDate.formatDate("yyyyMMddHH",row1.validUntil) )
tjavaRow
if (row1.isPermanent==1L) { out.validUntil_Long = -1L; }
3 step work as expected, but all together - not
Java 8, Windows
solutions it work well, just interesting - why? is it an error in the my IF code, error in talend or java version specific issue?
regards, Vlad
I can't see anything immediately obvious I'm afraid. The only thing that looks like it might lead to a null pointer exception is the row1.event.equals("TEXT") code. However, your working solution has this as well.
I will test it later, what source of error - mix of types or construction
I have multi conditions constructions for string only and all work as expected
at the same time I have working constriction like:
condition? (condition? (condition? true : false) : false) :(condition? true : (condition? true : false))
and it works with different types
so need to find a time and simulate test cases
Thank you for the answer Richard!
Thank for answer