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

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -