Skip to Content
0

Defining number of decimals in DecimalValue data type

Oct 21, 2016 at 11:03 AM

140

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Pradeep Kumar N
Oct 21, 2016 at 12:16 PM
1

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.

Share
10 |10000 characters needed characters left characters exceeded
Asif Raj Nov 01, 2016 at 04:16 PM
1

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks a lot Asif,

Yes we have deployed the soloution!

Regards
Sin

0
s sin Oct 31, 2016 at 01:58 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded