Solved

How to create a combo box for a decimal UDF column

  • 19 January 2024
  • 2 replies
  • 70 views

Userlevel 4
Badge

I created a UDF called UsrFTEV as a Decimal (2,2) column. (see screenshot below)
What I want to do is make this a Combo Box selection so that a user can only select the values either “1” or “.5”
For calculation reasons no other value should be allowed in that column.  However, I cannot figure out how to do that with a Decimal defined number.  I have done this very easily with Int and String values, but what should I do in the DAC definition?
[PXDBDecimal]
[PXUIField(DisplayName="FTEv")]

For Int column field this would be something like below
[PXIntList(new int[] {0,1}, new string[] {“0”,”1”})]

For a decimal number what is that command for a list?  And how can I change “NumberEdit” to “Combobox”? When I select “ComboBox” from the screen form data fields and Save, it reverts back to “NumberEdit”

 

 

 

icon

Best answer by Sagar Greytrix 7 February 2024, 09:47

View original

2 replies

Userlevel 4
Badge

BTW, I did try using this and it did not quite work for me.  Would not let me enter a 1.0

 

[PXDBDecimal]
[PXDecimalList( new string[] {"0.5","1.00"}, new string[] {"0.5","1.00"})]
[PXUIField(DisplayName="FTEv")]

 

Userlevel 5
Badge +1

Hi @NetAdmin42 ,

Could you please try below code snippet?

 #region Usrtest1
[PXDBString(4)]
[PXUIField(DisplayName="test1")]
[PXStringList(new string[] {"1.00", "0.5"}, new string[] {"1.00", "0.5"})]

public virtual string Usrtest1 { get; set; }
public abstract class usrtest1 : PX.Data.BQL.BqlString.Field<usrtest1> { }
#endregion

I have replaced datatype Decimal to String and added PXStringList attribute. It will converts cotrol type to ComboBox.

Above code will allow you to select the values which are declared in PXStringList attribute.

Hope, it helps!

Regards,

Sagar, Greytrix

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