javascript - Script to return null on string values in Mule Datamapper -



javascript - Script to return null on string values in Mule Datamapper -

i have element of type double in info mapper called capital. values come excel spreadsheet. when there no capital values "n/a" in excel. next error in mapper:

caused by: com.opensys.cloveretl.component.spreadsheet.exception.spreadsheetexception: cannot number value cell of type string in m3 in record 1, field 13 ("capital"), metadata

how can script mapper homecoming null or 0 whenever value of type string comes through?

you can utilize java methods available on info types when working script. looks problem here don't know if input value going string ("n/a") or decimal value. solve that, can take approach of converting string test , take appropriate action. don't have excel info mapper set @ moment didn't seek out, think should work.

output.captial = ((""+input.capital).equals("n/a") ? 0 : input.cellvalue);

by adding ("" + input.capital), casting string, in java.

javascript mule

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -