2

I'm trying to import a decimal value from an XML feed to a Drupal decimal number field.

For example the XML feed source is: 7,6
Now I want to import it in a Drupal decimal field. So the field value will be the same: 7,6

Thing is, when I import the feed and the nodes are getting created - this field remains empty. Is this a bug or can someone point out what I'm doing wrong here?

  • last time I checked decimals use a point . not a comma ,. Could that be your problem? or is the comma (7,6) a typo in your question? – No Sssweat Aug 31 '16 at 22:42
  • No typo. I'm from Europe and we use , for decimals instead of .. I'm getting the impression that may be the problem. – nerdrocker Aug 31 '16 at 23:02
3

It could be that the there is an issue with how it's interpreting the value especially if you are in a non-English context. For example, in Drupal's terms if you have a decimal value it's formatted like so "7.6". If you are trying to import a decimal value formatted with "7,6" it may have an issue.

If it is a bug, you could try and import and use a module like Feeds Tamper to rewrite that field output so that Drupal will import it.

I just tested myself and it imports fine using English decimal notation.

test output

  • 1
    Yes, you're right. I used Feeds Tamper to find and replace , to . and it works fine now. So for anyone with the same problem: decimal fields will not work with ,. You have to use Feeds Tamper to replace , to . to make it work. If you still want to use , in the field output you can change it to comma in the manage display settings of the field. – nerdrocker Aug 31 '16 at 23:12
  • Glad i could help! – Remog Aug 31 '16 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.