Question
I got the following error when I used the To Number logic to convert a string to a numeric type for numerical operation.
What is the cause and what can I do about it?
Convert Logic - Unable to convert String type to BigDecimal type.
Answer
About the error
The error "Unable to convert String type to BigDecimal type" occurs when the string used character that cannot be converted to numeric type as input data.
Possible causes
The input data may contain a character that cannot be converted to numerical type by To Number logic.
Workaround
Please set log level to DEBUG and make sure that input data does not contain character that cannot be converted to numeric type, such as empty characters, commas, or multi-byte characters.
Example:
- In the case of an empty or null character, convert it to 0 using Mapper's Replace Null/Empty String logic before converting it to a numeric value.
- In the case of commas, use Mapper's Replace by Regular Expression logic to remove commas from the data.
- In the case of using data read from files such as xlsx files, make sure to check that the header of the file is not read as data unwantedly.
Supplementation
- The numeric type handled by Mapper is BigDecimal type, which can accurately represent data including decimal points.
When numerical operations are performed on string types, they are converted to BigDecimal type for processing.
Notes
When the log level is set to DEBUG, your Integrate Service load may be going to be huge as it increase the amount of logs output. Therefore, it is encouraged to set the log level back as before after checking the log.
Comments
0 comments
Article is closed for comments.