About EasyMorph Tutorials & Examples Web-help

Decimal separator at import of CSV

Hi,

When an erroneous value is present in a CSV e.g. “3,2,2” and this is imported it is imported as text.
When this is transformed to numeric value with “.” as decimal separator, it is converted to 322.
Are there possibilities to exclude the erroneous values from conversion? The convert data type action will convert the value also.

You can use contains() to check if a value contains comma before converting it into a number. E.g.:

if(not contains([Data], ','), asnumber([Data]), [Data])

Hi Dmitry,

Thanks for the reply.
Is it normal that values with multiple commas are transformed to number?
Shouldn’t it be better if we also could indicate a thousand separator when converting to numbers ?

Suppose someone has delivered a source datasets with a mixture of correct data and erroneous data (data with multiple commas). When we transform this to numeric, it will convert it but actually, the conversion could be wrong since we do not know if it’s a thousand separator or an error at input.

It may be better but I don’t see it as critical at this point. There are workarounds to deal with it. The most common workaround - import text lines without specifying a separator at all. Then parse it in EasyMorph using regular actions and text functions.

To learn more about EasyMorph visit easymorph.com.