Hi !

First, thanks you very much for this wonderful and useful module !

Here is my problem: i am unable to import float number into a float field. The field juste stay empty.
I made an import test with a non float number and it worked juste fine.
I use comma as decimal marker. The format for import feed is CSV with ; as delimiter

Notice: i use PostgreSQL 8

Comments

jibus’s picture

Title: PostgreSQL - Unable to import float number » Unable to import float number
Status: Active » Closed (works as designed)

Ok, i juste tested with a mysql db, i have the same result.

In fact, it worked if we use a dot instead of a comma in the csv file.

bobodrone’s picture

Status: Needs review » Closed (works as designed)
StatusFileSize
new888 bytes

Just a thought: Is comma a forbidden character when it comes to float values in CSV files?
I just downloaded a huge csv file which uses comma as float separator character instead of dot or period and it uses semicolon as separator between the fields.

I noticed that there is a function inside mappers/field.inc that don´t think that a value with a comma (float in this case) is valid as a numeric value but it could actually be that. The value "3,14159" is therefore not considered to be a valid numeric value but "3.14159" is. The other part is thatwe can not store a float value with a comma in the db, we need to convert it to a period instead.

My patch looks for a numeric value that have a comma surrounded by digits, then it is a float value and it need to convert the comma to a dot/period to be possible to store in the database.

This patch solves that issue.

/ Bobodrone

bobodrone’s picture

Version: 7.x-2.0-alpha5 » 7.x-2.x-dev
Status: Closed (works as designed) » Needs review

Reopen the issue.

bobodrone’s picture

Status: Closed (works as designed) » Needs review
StatusFileSize
new888 bytes

Slightly better regex, where it checks the beginning of the string as well. :)

twistor’s picture

Title: Unable to import float number » Add separator to floats and decimals.
Category: bug » feature
Issue tags: +Needs tests
StatusFileSize
new2.86 KB

Can you give this a try?

twistor’s picture

Issue summary: View changes
Status: Needs review » Needs work

This doesn't apply anymore.

condor616’s picture

Status: Needs work » Needs review
StatusFileSize
new2.54 KB

Rerolled the patch for #5
For list_float the solution doesn't work yet.

bluegeek9’s picture

Status: Needs review » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.