Rounding on Item Attribute of type Decimal

johnnypjohnnyp Member Posts: 13
Hello.

I hope some can help me with this question about Item Attributes and the weird rounding of attribute type Decimal.

For starters, we are using Dynamics NAV 2017. I created an Item attribute of type Decimal. Then I added it to an Item and entered value 1000. I closed the Attributes window and reopened it, and the value was 1. I entered 1.000 with the same result, as 1.000,00 and 1000,00

I tried entering 10000, closed the window and reopened it, and the value was 10. Same hapened when I entered 100000, only the value was set to 100. It looked like it divided entries by 1000, however when I entered 1000000 it stored it as 1000000. Weird right? Some other numbers: 3400 rounded to 3,4. 250 not rounded. 34000 rouned to 34.

If anyone understands what the heck I'm talking about, I would greatly appreciate an explanation.

Best regards, John

Best Answer

Answers

  • JuhlJuhl Member Posts: 706
    Hi John
    I modified the solution, as it is error prone to culture. As I remember it’s due to not all functions in the solution being culture independent in handling decimal.
    I modified it a few places to always evaluate to XML.
    It’s because the value field in attribute is text, to be generic.
    Follow me on my blog juhl.blog
  • johnnypjohnnyp Member Posts: 13
    Thank you Juhl, but I'm afraid I don't quite understand what you mean.
  • DenSterDenSter Member Posts: 8,203
    Check the table object and see if there is any code in OnValidate. Just a plain decimal field should not behave like that
  • JuhlJuhl Member Posts: 706
    Its not a decimal, but a text field.
    Follow me on my blog juhl.blog
  • johnnypjohnnyp Member Posts: 13
    Oh, It's a text field? I thought that table 7501 stores texts in field "Value" and numbers in field "Numeric value" ... maybe i'm getting this all wrong.
  • johnnypjohnnyp Member Posts: 13
    A, yes, now I understand. Thank you for the explanation.
Sign In or Register to comment.