Skip to main content

Need to filter out vendor codes from BAccount DAC. Now it is loading all the BAccounts.

#region VendorID       
         PXUIField(DisplayName = "Vendor", Required = true)]
        ÂPXDBDefault(typeof(BAccount.bAccountID))]
        rPXSelector(typeof(Search<BAccount.bAccountID>),
                    typeof(BAccount.acctCD),
                    typeof(BAccount.acctName),

        SubstituteKey = typeof(BAccount.acctCD),
        DescriptionField = typeof(BAccount.acctName))]
        public virtual int? BAccountID { get; set; }
        public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
        #endregion

@bhagyat25  Please try with the below code.

 

 #region VendorID       
         PXUIField(DisplayName = "Vendor", Required = true)]
        PXDBDefault(typeof(BAccount.bAccountID))]
        ]PXSelector(typeof(Search<BAccount.bAccountID,Where<BAccount.type,Equal<BAccountType.vendorType>>>),
                    typeof(BAccount.acctCD),
                    typeof(BAccount.acctName),

        SubstituteKey = typeof(BAccount.acctCD),
        DescriptionField = typeof(BAccount.acctName))]
        public virtual int? BAccountID { get; set; }
        public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
        #endregion


This is how it would be written in F-bql:

[PXSelector(typeof(SearchFor<BAccount.bAccountID>.
In<SelectFrom<BAccount>.
Where<*your_conditions*>>),
typeof(BAccount.acctCD),
typeof(BAccount.acctName),
SubstituteKey = typeof(BAccount.acctCD),
DescriptionField = typeof(BAccount.acctName))]

However, if you’re looking for Vendors, it would be better to query from the Vendor table directly, as not all BAccounts will be Vendors, obviously.

Acumatica also provides some selector attributes out of the box which would probably save you some time writing a selector yourself, for instance dVendorRaw] or dVendorActive].


Reply