Casting the type from a string/unknown to double wihout changing the format

Hi all,

 

I need to check if a column with doubles is in the correct format. So a number shouldn't include a thousand serpator and only 2 decimals. So: 12345,22 is ok. But 12.345,22 is not correct. But the column is read as a string type due to additional rows under the header with comment. Those rows get removed before checking.

And when I try to cast the string to a double the cast automaticly let me choose to add or remove a thousand seperator. But I don't want to change it. I want te make a remark that it is not correct. So the format of the number shouldn't change.

 

Is this possible?

 

Thanks!

So if I understand correctly, all you want to do is test the column ? 

In that case, I guess a String Manipulation node will do it. In the said node you can test the format of the column using toDouble() or regexMatcher() and wrap it with toBoolean(): toBoolean(toDouble($mystringnumber$) != null)

You'll obtain a new boolean column which tells you for each row whether or not the number can be converted to double type. For more complex tests, you'll probably have to look into the regexMatcher() function.