Being Novice in Java,We are trying to write calculated field as ship date if-then-else statement into java with an eclipse (Talend DI TOOL)
Environment : we are trying to create job in talend.
source systems (sql server and excel file)---->tmap---->Target system(Excel file)
Input Expression : if-then-else formula
ship date
if ([Customer])='0000001' or
(TRIM([Corp Acct Name]))='GENERAL' or (TRIM([Corp Acct Name]))='ABC' or (TRIM([Corp Acct Name]))='XYZ'
or (TRIM([Corp Acct Name]))='CDE' then ([ShipDate])
elseif DATEPART('weekday',([MABD])) =1 and [Total Lead Time]<=5 then (([MABD])-[Total Lead Time]-2)
elseif DATEPART('weekday',([MABD])) =1 and [Total Lead Time]>5 then (([MABD])-[Total Lead Time]-4)
elseif DATEPART('weekday',([MABD])) =2 and [Total Lead Time]<=1 then (([MABD])-[Total Lead Time])
elseif DATEPART('weekday',([MABD])) =2 and [Total Lead Time]<=6 then (([MABD])-[Total Lead Time]-2)
elseif DATEPART('weekday',([MABD])) =2 and [Total Lead Time]>6 then (([MABD])-[Total Lead Time]-4)
elseif DATEPART('weekday',([MABD])) =3 and [Total Lead Time]<=2 then (([MABD])-[Total Lead Time])
elseif DATEPART('weekday',([MABD])) =3 and [Total Lead Time]<=7 then (([MABD])-[Total Lead Time]-2)
elseif DATEPART('weekday',([MABD])) =3 and [Total Lead Time]>7 then (([MABD])-[Total Lead Time]-4)
elseif DATEPART('weekday',([MABD])) =4 and [Total Lead Time]<=3 then (([MABD])-[Total Lead Time])
elseif DATEPART('weekday',([MABD])) =4 and [Total Lead Time]<=8 then (([MABD])-[Total Lead Time]-2)
elseif DATEPART('weekday',([MABD])) =4 and [Total Lead Time]>8 then (([MABD])-[Total Lead Time]-4)
elseif DATEPART('weekday',([MABD])) =5 and [Total Lead Time]<=4 then (([MABD])-[Total Lead Time])
elseif DATEPART('weekday',([MABD])) =5 and [Total Lead Time]<=9 then (([MABD])-[Total Lead Time]-2)
elseif DATEPART('weekday',([MABD])) =5 and [Total Lead Time]>9 then (([MABD])-[Total Lead Time]-4)
elseif DATEPART('weekday',([MABD])) =6 and [Total Lead Time]<=4 then (([MABD])-[Total Lead Time]-1)
elseif DATEPART('weekday',([MABD])) =6 and [Total Lead Time]<=9 then (([MABD])-[Total Lead Time]-3)
elseif DATEPART('weekday',([MABD])) =6 and [Total Lead Time]>9 then (([MABD])-[Total Lead Time]-5)
elseif DATEPART('weekday',([MABD])) =7 and [Total Lead Time]<=4 then (([MABD])-[Total Lead Time]-2)
elseif DATEPART('weekday',([MABD])) =7 and [Total Lead Time]<=9 then (([MABD])-[Total Lead Time]-4)
elseif DATEPART('weekday',([MABD])) =7 and [Total Lead Time]>9 then (([MABD])-[Total Lead Time]-6)
END
We tried :Ternery operator in talend
row1.customer='0000001'|| trim(row1.CorpAcctName)='GENERAL'|| trim(row1.CorpAcctName)='ABC' or trim(row1.CorpAcctName)='XYZ or trim(row1.CorpAcctName)=='SCDE' ||?row1.ShipDate:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD)=1)-1) and row2.L+1<5?row1.MABD-row2.L+1-2:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=1)-1) and row2.L+1>5?row1.MABD-row2.L+1-4:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=2)-1) and row2.L+1<=1?row1.MABD-row2.L+1:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=2)-1) and row2.L+1<=6?row1.MABD-row2.L+1-2:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=2)-1) and row2.L+1>6?row1.MABD-row2.L+1-4:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=3)-1) and row2.L+1<=2?row1.MABD-row2.L+1:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=3)-1) and row2.L+1<=7?row1.MABD-row2.L+1-2:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=3)-1) and row2.L+1>7?row1.MABD-row2.L+1-4:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=4)-1) and row2.L+1<=3?row1.MABD-row2.L+1:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=4)-1) and row2.L+1<=8?row1.MABD-row2.L+1-2:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=4)-1) and row2.L+1>8?row1.MABD-row2.L+1-4:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=5)-1) and row2.L+1<=4?row1.MABD-row2.L+1:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=5)-1) and row2.L+1<=9?row1.MABD-row2.L+1-2:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=5)-1) and row2.L+1>9?row1.MABD-row2.L+1-4:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=6)-1) and row2.L+1<=4?row1.MABD-row2.L+1-1:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=6)-1) and row2.L+1<=9?row1.MABD-row2.L+1-3:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=6)-1) and row2.L+1>9?row1.MABD-row2.L+1-5:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=7)-1) and row2.L+1<=4?row1.MABD-row2.L+1-2:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=7)-1) and row2.L+1<=9?row1.MABD-row2.L+1-4:
Integer.toString (TalendDate.getPartOfDate("DAY_OF_WEEK",row1.MABD=7)-1) and row2.L+1>9?row1.MABD-row2.L+1-6:""
Any help on it would be much appreciated ?
Aucun commentaire:
Enregistrer un commentaire