You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

Hi,
I would like to make work this code below in the Tmap component, could you tell me how to do i'm actually stuck.
(row1.Code_acte ==row2.Code)?TalendDate.compareDate(row2.DateActe,row1.Datedebut,"dd-MM-yyyy"):null
If the code are equals, i want to compare 2 dates, if not i want nothing to be done.
Thanks for your help !
Offline
Hi Benoit,
What do you want to return?
Are the Code_acte and Code numeric or string? If they are strings, use row1.Code_acte.equals(row2.Code) instead of ==
You may want to add a check to see if row1.Code_acte is null to help avoid NPEs.
null != row1.Code_acte?(row1.Code_acte.equals(row2.Code)?TalendDate.compareDate(row2.DateActe,row1.Datedebut,"dd-MM-yyyy"):null):null
compareDate returns and integer (-1, 0 or 1). Does your ouput field allow for nulls?
Thanks,
Ben
Offline

Ok, first thanks for your solution.
Code_acte and code are numeric, that's why I use ==
How could I know if my output fileds allows null value ? (=>Except for the primary key, they are all nullable)
Even if i transform Code_acte and code in string, I still have my compilation problem, and it doesn't tell me more than "Exception in thread main java.lang.error: compilation pb non resolved"
I rly don't see where is the mistake, I'm actually testing several expressions to check what I can do/cannot do, but if sbdy knows more, it will help !
Thanks for your help
Offline

After a few test i know that my date field aren't good because i cannot use the compareDate function,
When I test TalendDate.compareDate(row2.DateActe,row1.Datedebut,"dd-MM-yyyy") i've got the same message "Exception in thread..." WHY ??
Datedebut, type: Date, nullable, model "dd-MM-yyyy" length: 26
DateActe, type: Date, nullable, model "dd-MM-yyyy" length: 26
The files used come from AccessInput.
Thanks for your help !
Offline

After a new serie of test, i can tell you that the test button in the TMap component doesn't work correctly, when I execute the job it works (just with compareDate) and when I test the expression in the Tmap it still tells me "Exception in thread..."
So the test button doesn't work -_-
Offline

Ok, but do you happen to know how could I program what i want in the 1st message, cause I still can't make it work, now i've got a null pointer exception, I'm trying to avoid it but I think data processing will last too long.
Thanks for your help !
Offline
Is you NPE pointing to this expression, or is the problem that the output field does not allow nulls?
You could check all input params for null first.
(null != row1.Code_acte && null != row2.DateActe && null != row1.Datedebut) ?(row1.Code_acte.equals(row2.Code)?TalendDate.compareDate(row2.DateActe,row1.Datedebut,"dd-MM-yyyy"):null):null
Offline

Hi
I can't fix this damn NPE, all my fields allow null, but then it still doesn't work.
The problem is due to an exeption in component tAccessOutput_1, but I see nothing wrong in it.
So what does mean this error message, something wrong with my Tmap component or with my tAccessOutput ?
Thanks for your help !
Offline

Sorry but how can i know the line that generate the NPE, my message error is this one :
Exception in component tAccessOutput_1
java.lang.NullPointerException
at projetlocal.testcodeacte2_0_1.TestCodeActe2.tAccessInput_1Process(TestCodeActe2.java:1240)
....
Can't find my mistake, action on table weither it's create nor drop if it exist and create doesn't change anything. Id I edit the schem and change the type of my data, the error message changes, it becomes and ODBC exception.
Thanks for your help !
Offline
Pages: 1