Trying to convert String to number (want to capture the records which cant be converted)

Hi All,

I am trying to convert some string columns to number, before converting I want to capture rows which cant be converted to number and send these rows to exception table. Can someone let me know the best approach to achieve this.

Help is appreciated!!!

Hi there @sauravh86,

that makes sense and probably Rule-based Row Splitter node can do the trick but you would have to share example of your data in order to get more concrete help…

Br,
Ivan

@ipazin

Column 1 Column 2 Column 3
100 123 146
100 123 dfg
100 123 123
100 123 123
100 123 123
100 123 123
abc 123 123

If I have data in the format and I want to convert column 1 ,column 2 and column 3 to number. I want row 2 and row 7 to go to exception table before conversion and rest of the data should be converted.

@ipazin

Column 1 Column 2 Column 3
100 123 146
100 123 dfg
100 123 123
100 123 123
100 123 123
100 123 123
abc 123 123

If I have data in the format and I want to convert column 1 ,column 2 and column 3 to number. I want row 2 and row 7 to go to exception table before conversion and rest of the data should be converted.

hi @sauravh86,

so you can use regex (MATCHES function) in Rule-based Row Splitter node. Write one rule for every column like this:

Dot and comma are here in case you have decimal numbers and/or separator in your data. If not you can delete them.

Br,
Ivan

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.