Solved

Creating a Numeric Attribute

  • 8 August 2023
  • 5 replies
  • 286 views

Userlevel 3
Badge

We have created an attribute   CommPCT, Control Type = Text,  Format = #.####

Data Entry looks like this.   0.015   This is meant to be a Value of 1.5%

We next created a Custom Generic Inquiry that uses the CommPCT in a formula,

TransAmt * CommPCT.  However, the formula does not recognize the “.” in the text or recognize the value as a numeric value.  Next we created a formula like this.   =[ARDetail.CuryTranAmt]*cdec([InventoryItem.COMMPCT_Attributes])

This sort of works,  It does the multiplication as 15 instead of .015 again this is because the “.” is not recognized numerically.   

How do I get the 0.015 recognized as a numeric decimal value?   

 

 

icon

Best answer by darylbowman 9 August 2023, 20:03

View original

5 replies

Userlevel 4
Badge

As far as I know, attributes do not support numeric values. Well storing them as numeric. 

 

Badge +18

Hello,

Perhaps you can try Naveen’s suggestion fBest Answer on a post from last year. He suggests CDbl conversion:

=CDbl((IsNull([Length.Value],0)))*CDbl((Is,Null([Rate.Value],0)))*CDbl((IsNull([Mass.Value],0)))+ CDbl( (IsNull([Punch.Value],0)))

 

Laura

Badge +11

This is because the Entry Mask only manages appearances. The underlying value is not stored with a decimal.

Here’s the proof:

(new attribute with Entry Mask)

 

(item using new attribute, with value 0.015)

 

(database value of 0015)

 

 

Perhaps a better alternative would be to store the value as a whole number (ie 15 for 15%) and then divide the value by 100 in your calculation.

You could also simply forego the Entry Mask and instead use Reg Exp to specify a decimal format. This regex requires a decimal starting with 0. with up to three decimal places: ^0\.(?!0+$)\d{1,3}$

Userlevel 3
Badge

I tried the above, and still not getting the correct solution.  All solutions i have tried has converted the text value.   “0.015”  into a numeric value of 15.   It needs to be a numeric value of 0.015   It seems to me that any conversion Cdbl, Cint, Cdec, etc…  does not recognize to decimal in the text value and just converts the number from right to left leaving a numeric value of 15.

Badge +11

...does not recognize to decimal in the text value...

Yes, exactly, because there is no decimal in the database value. If you want to add a decimal, you need to remove the Entry Mask and enter the decimal yourself. The Reg Exp would simply require that the value entered has a decimal before it would allow saving.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved