Five Stars


Dear All,
I face to a problem of CompareDate in my tMap and i try all solution but i still get wrong output.
The logic i apply is to fixe two Dates:

Date1 that i call "FirstDate" is in format MM/DD/yyyy and is fixed like that:       previous Month/20/Year
Date2 that i call "SecondeDate" is in format MM/DD/yyyy and is fixed like that: current Month/19/Year

So to get output, i make some comparison of date that i call var1, var4, var5 
And in my job i upload, i just apply var4 but i get wrong output.
Exemple of wrong output: All rows that year equal 2015
NB: In attach you find also my input file that i change format to txt so just put it in csv to make test
Thank you for help,
Sixteen Stars


I'm afraid you will need to give an actual example of what is happening and simplify your question. I looked at your job briefly and what you are doing with dates looks like it can probably be simplified a fair bit. You say you get an error with the output of var4 connected to dates with 2015 as the year. I looked briefly at the code and this variable expression looked somewhat odd to me....
Var.MonthFirstDate == 0 ?  "12/20/"+Var.YearFirstDate_1 :  Var.MonthFirstDate+"/20/"+Var.YearFirstDate  

It looks like when the month is January you are setting it back to December of the previous year, yet when it is any other month, the year remains as does the month. 
As I said, this is a wild guess because I do not know the requirement. 
Five Stars


Hello rhal_2.0,
You are right, my explaination is not top reason why i add also my job. 
But i try to explain myself again; in the code you attach in your post, you find the expression Var.MonthFirstDate that i get this expresssion

So in December, i note that this code return like value  0 insteade of 12; reason why i writte this code bellow to fixe month
Var.MonthFirstDate == 0 ?  "12/20/"+Var.YearFirstDate_1 :  Var.MonthFirstDate+"/20/"+Var.YearFirstDate

To resume my question; i mean my problem is in TalendDate.comperaDate() function which is in var1, var4 and var5
For exemple in var1, i writte:
TalendDate.compareDate(row2.Date_debut_arret_travail,Var.FirstDate1,"MM,dd,yyyy") <= 0 &&

I think this function does not work, i change the last part with: "MM/dd/yyyy" but it does not change nothing
Thanks for help,