jeudi 27 octobre 2016

Talend tmap- Method in the type is not applicable to the arguments

We have talend tool which uses java code. We are trying to compile and test following ternary operator.

Information of Data type we used here:

ShipDateCalculated- Date

CorpAcctName -String

ShipDate - Date

Input data:

We are trying to run following syntax in talend tmap component.

 row1.ShipDateCalculated==null?
("ABC".equalsIgnoreCase(row1.CorpAcctName) || "BCD".equalsIgnoreCase(row1.CorpAcctName)||"CDE".equalsIgnoreCase(row1.CorpAcctName))?
TalendDate.getPartOfDate("DAY_OF_WEEK",row1.ShipDate) ==1?
TalendDate.addDate(TalendDate.formatDate("MM/dd/yyyy", row1.ShipDate ),"MM/dd/yyyy",-3,"dd"):
TalendDate.getPartOfDate("DAY_OF_WEEK",row1.ShipDate) ==2?
TalendDate.addDate(TalendDate.formatDate("MM/dd/yyyy", row1.ShipDate ),"MM/dd/yyyy",-3,"dd"):
TalendDate.addDate(TalendDate.formatDate("MM/dd/yyyy", row1.ShipDate ),"MM/dd/yyyy",-2,"dd"):
TalendDate.getPartOfDate("DAY_OF_WEEK",row1.ShipDate) ==1?
TalendDate.addDate(TalendDate.formatDate("MM/dd/yyyy", row1.ShipDate ),"MM/dd/yyyy",-2,"dd"):
TalendDate.addDate(TalendDate.formatDate("MM/dd/yyyy", row1.ShipDate ),"MM/dd/yyyy",-1,"dd"):
"" 

Getting Error

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    The method equalsIgnoreCase(String) in the type String is not applicable for the arguments (Date)

WE TRIED :

TalendDate.parseDate("MM/dd/yyyy",("ABC".equalsIgnoreCase(row1.CorpAcctName) || "BCD".equalsIgnoreCase(row1.CorpAcctName)||"CDE".equalsIgnoreCase(row1.CorpAcctName)))

Thanks for valuable time !

Aucun commentaire:

Enregistrer un commentaire