Solved

UNIQUE constraint on DAC column

  • 12 October 2022
  • 2 replies
  • 100 views

Userlevel 6
Badge +3

I have a field in a custom DAC and I created a SQL constraint to ensure it is unique.

    [FromCustomerID] [int] NOT NULL UNIQUE,

Is there a way I can setup this DAC field to enforce this constraint so that it doesn’t require the DB to be hit prior to identifying the value entered in a grid is invalid?

This is my DAC field:

        #region FromCustomerID
        [Customer(IsKey = true)]
        [PXUIField(DisplayName = "From Customer")]
        [PXRestrictor(typeof(Where<BAccount.parentBAccountID, IsNull>), ICSMessages.ChildAccount)]
        public virtual int? FromCustomerID { get; set; }
        public abstract class fromCustomerID : PX.Data.BQL.BqlInt.Field<fromCustomerID> { }
        #endregion

icon

Best answer by Dmitrii Naumov 12 October 2022, 17:44

View original

2 replies

Userlevel 7
Badge +5

There is PXCheckUniqueAttribute that does that.

See here:

https://help-2022r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=2ed40453-9ee2-eaba-18f4-0df790282512

Userlevel 6
Badge +3

Thank you @Dmitrii Naumov .  I knew there had to be a way.  FYI, Looks like I am Semi-Pro I.  Someone needs to fix the algorithm.  There’s no way I am semi-pro…  HA!  😋

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