Skip to Content

Defining number of decimals in DecimalValue data type

Dear All,

Hope you are fine

I have a question about defining the number of decimals.
We have created a field in CustomerQuote.xbo with the type of: decimalValues.

I want to know is there any way that we can define the number of decimals for example to be always 2.

As I found it is not possible,
Does anyone have any idea?

Regards
Sin

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 21, 2016 at 12:16 PM

    Hi Sin,

    You could use :

    [Decimal (5,2)] element dAmt: DecimalValue;

    where 5 is the number of digits allowed and 2 is the number of digits allowed after decimal place.

    Thanks, Pradeep.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 01, 2016 at 04:16 PM

    If you have already set the data type as Quantity, you cannot change it if you have deployed the solution to production.

    You can use the combination of Numeric.RoundToString and Numeric.ParseFromString functions to round off the value stored in the extension field and convert it back to the type quantity during save.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 01:58 PM

    Hi Pradeep,

    Thanks a lot for your response and sorry for my late answer,

    Actually we have a custom field that is a type of "Quantity" and we want the decimal value to be shown max 2 number.
    But when I add [Decimal (5,2)] to my element, the system gave me an error that


    Parameter '[5,2]' of annotation Decimal is expected to be of type 'DecimalValue'.

    But my DataType is Quantity, I can not change it,

    Do you have any other suggetsion?

    Regards
    Sin

    Add comment
    10|10000 characters needed characters exceeded