cancel
Showing results for 
Search instead for 
Did you mean: 

import prices from csv

Former Member
0 Kudos

Hi

From a csv file, I am trying to import a row with price values as "1,234.56" with column header orderTotal[numberformat=#,###.##] and locale is english. Price is enclosed in quotes so that it is not understood as a delimiter.

However in HMC, price is getting saved as 1.00 (so impex import is taking first character and ignoring the rest) if I change price to 8,400.00, I see value as 8.00 in HMC.

is it a bug ?

Accepted Solutions (0)

Answers (1)

Answers (1)

andyfletcher
Active Contributor
0 Kudos

I've never found that the numberformat attribute gets honored. I think the default locale is de_DE so comma is the decimal separator and period is the thousands separator.

Try prepending your impex with this line to set the locale to en_GB which will cause the period to be the decimal separator and the comma to be the thousands separator.

 #% impex.setLocale(java.util.Locale.UK)
Former Member
0 Kudos

Hi Andrew

Thank you for a quick response!

after removing number format from the header, price gets imported but in HMC, I see price as 8,400.00

is there any way to save it as 8400.00 (i.e. without a comma) ? we want our commerce team to pick price as is and not be concerned with price formats and unchecked NumberFormatExceptions.

Why is numberFormat not honored if its provided ? if I may ask.

andyfletcher
Active Contributor
0 Kudos

Well that's a different question! The number is stored internally as a double. It's just the rendering of it in the hMC that puts the comma in it. I'm guessing that it's the default formatting for numbers for your locale. http://docs.oracle.com/javase/tutorial/i18n/format/numberFormat.html

There are properties for changing the date and time format (``date.pattern`` and time.pattern) in the hMC but I don't know of an equivalent for numbers in the hMC.

Sorry, I don't know why numberformat on impex is ignored. That's just my experience of it. You'd be better asking someone at Hybris.