J. Nicastro
J. Nicastro

Reputation: 254

Azure Data Factory: Reading doubles with a comma as decimal separator instead of a dot

I'm currently trying to read from a CSV files ( separated with semicolon ';') with decimal numbers formatted with a comma(,) as a decimal separator instead of a dot (.).

i.e: the number 12356.12 is stored as 12356,12.

In the source's projection, what would be the correct format to read the value correctly?

The format should in Java Decimal Format

enter image description here

Upvotes: 1

Views: 6345

Answers (3)

You could always edit the format of the data Type in the Data flow with a Cast activity enter image description here

Under Cast settings -> edit the format from String to Double enter image description here

Upvotes: 0

WickedGarlic
WickedGarlic

Reputation: 31

True answer is in the comments: In the copy job the culture can be defined, which influences the decimal separator. Go to "mapping" > "Type conversion settings" > "culture" and chose en-us, de-de or whatever works for you. Be aware that this will also influence other types like dates.

Upvotes: 2

Jay Gong
Jay Gong

Reputation: 23782

If your CSV file's columnDelimiter is a comma (','), your first concern is how to avoid your number data won't be treated as different columns. Since your number data is stored as 12356,12, so my suggests as below :

  1. Change the columnDelimiter as | or other special characters.

2.Set escape char. Please see this description:

enter image description here

In addition, 12356,12 can't be identified as Decimal format in ADF automatically. And no such mechanism o turn , into .. So I think you need to transfer data as string temporary. Then convert it into Decimal in your destination with java code.

Upvotes: 2

Related Questions