Filters in Acumatica

Hello everybody,

in this article I want to describe how filtering in Acumatica work. When I say filtering, I mean following UI part:

In manuals T100 - T300 there is almost nothing about how filters work, so I want to share few bits of development information.

Storage

All information about filters is stored in database in tables FilterRow and FilterHeader.

Take a look on screenshot of FilterInformation for some custom applied filter:

 

As you can see from screenshot Acumatica stores information about filters by FilterID, and has information like Condition, values, Close brackets, operators and so on.

Also there are DAC classes FilterRow and FilterHeader, but you can find them only with help of reflector or any other "spy tool".

Modification

Acumatica allows you to work with filters with help of Search functionality in selector and similar to it ( for example Search2 ). Take a look on declaration of filter of APPayment column RefNbr:

        [PXDBString(15, InputMask = ">CCCCCCCCCCCCCCC", IsKey = true, IsUnicode = true)]
        [PXDefault]
        [PXUIField(DisplayName = "Reference Nbr.", TabOrder = 1, Visibility = PXUIVisibility.SelectorVisible)]
        [APInvoiceType.RefNbr(typeof(Search2<APRegisterAlias.refNbrInnerJoinSingleTable<APInvoiceOn<APInvoice.docType, 
            Equal<APRegisterAlias.docType>, And<APInvoice.refNbrEqual<APRegisterAlias.refNbr>>>, 
            InnerJoinSingleTable<VendorOn<APRegisterAlias.vendorIDEqual<Vendor.bAccountID>>>>, 
            Where<APRegisterAlias.docTypeEqual<Optional<APInvoice.docType>>, 
                And2<Where<APRegisterAlias.origModuleNotEqual<BatchModule.moduleTX>, Or<APRegisterAlias.released, 
                    Equal<True>>>, And<Match<VendorCurrent<AccessInfo.userName>>>>>, OrderBy<Desc<APRegisterAlias.refNbr>>>), 
            Filterable = true, IsPrimaryViewCompatible = true)]
        [APPaymentType.Numbering]
        [PXFieldDescription]

The same filtering is applied at APInvoice. And now you can ask, ok, so what it gives me? Actually it means that by default, if you make some filter as default for screen of invoices, then the same filter will be default and applied to Bills. If you wonder how to split those siameses twins?

The idea is simple, make your own duplicate of class APRegisterAlias, and via CacheAttached add it to needed screen. Below goes code, that I've used for this purpose:

public class APPaymentEntryExt : PXGraphExtension<APPaymentEntry>
    {
        [PXDBString(15, InputMask = ">CCCCCCCCCCCCCCC", IsKey = true, IsUnicode = true)]
        [PXDefault]
        [PXUIField(DisplayName = "Reference Nbr.1", TabOrder = 1, Visibility = PXUIVisibility.SelectorVisible)]
        [APInvoiceType.RefNbr(typeof(Search2<APRegisterAliasSep.refNbrInnerJoinSingleTable<APInvoiceOn<APInvoice.docType, 
            Equal<APRegisterAliasSep.docType>, And<APInvoice.refNbrEqual<APRegisterAliasSep.refNbr>>>, 
            InnerJoinSingleTable<VendorOn<APRegisterAliasSep.vendorIDEqual<Vendor.bAccountID>>>>, 
            Where<APRegisterAliasSep.docTypeEqual<Optional<APInvoice.docType>>, 
                And2<Where<APRegisterAliasSep.origModuleNotEqual<BatchModule.moduleTX>, Or<APRegisterAliasSep.released, 
                    Equal<True>>>, And<Match<VendorCurrent<AccessInfo.userName>>>>>, OrderBy<Desc<APRegisterAliasSep.refNbr>>>), 
            Filterable = true, IsPrimaryViewCompatible = true)]
        [APPaymentType.Numbering]
        [PXFieldDescription]
        protected void APPayment_RefNbr_CacheAttached(PXCache sender)
        {
        }
    }
 
    [PXHidden]
    [PXPrimaryGraph(new[] { typeof(APQuickCheckEntry), typeof(TXInvoiceEntry), typeof(APInvoiceEntry), typeof(APPaymentEntry) }, 
        new[] { typeof(Select<APQuickCheckWhere<APQuickCheck.docTypeEqual<Current<APQuickCheck.docType>>, 
            And<APQuickCheck.refNbrEqual<Current<APQuickCheck.refNbr>>>>>), typeof(Select<APInvoice, 
                Where<APInvoice.docTypeEqual<Current<APInvoice.docType>>, 
                    And<APInvoice.refNbrEqual<Current<APInvoice.refNbr>>, 
                        And<Where<APInvoice.releasedEqual<False>, And<APRegister.origModule, 
                            Equal<BatchModule.moduleTX>>>>>>>), typeof(Select<APInvoiceWhere<APInvoice.docType, 
                                Equal<Current<APInvoice.docType>>, And<APInvoice.refNbr, 
                                    Equal<Current<APInvoice.refNbr>>>>>),
            typeof(Select<PX.Objects.AP.APPaymentWhere<PX.Objects.AP.APPayment.docType, 
                Equal<Current<PX.Objects.AP.APPayment.docType>>, And<PX.Objects.AP.APPayment.refNbr, 
                    Equal<Current<PX.Objects.AP.APPayment.refNbr>>>>>) })]
    [Serializable]
    public class APRegisterAliasSep : APRegister
    {
        public abstract class selected : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class hidden : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class branchID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class docType : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class printDocType : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class refNbr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origModule : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class docDate : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origDocDate : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class tranPeriodID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class finPeriodID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class vendorID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class vendorID_Vendor_acctName : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class vendorLocationID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class aPAccountID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class aPSubID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class lineCntr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyInfoID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyOrigDocAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origDocAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDocBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class docBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class discTot : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDiscTot : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class docDisc : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDocDisc : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyOrigDiscAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origDiscAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDiscTaken : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class discTaken : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDiscBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class discBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyOrigWhTaxAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origWhTaxAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyWhTaxBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class whTaxBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyTaxWheld : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class taxWheld : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyChargeAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class chargeAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class docDesc : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class createdByID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class createdByScreenID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class createdDateTime : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class lastModifiedByID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class lastModifiedByScreenID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class lastModifiedDateTime : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class Tstamp : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class docClass : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class batchNbr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class prebookBatchNbr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class voidBatchNbr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class released : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class openDoc : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class hold : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class scheduled : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class voided : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class printed : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class prebooked : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class noteID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class refNoteID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class closedFinPeriodID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class closedTranPeriodID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class rGOLAmt : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyRoundDiff : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class roundDiff : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyTaxRoundDiff : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class taxRoundDiff : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class status : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class scheduleID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class impRefNbr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class isTaxValid : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class isTaxPosted : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class isTaxSaved : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origDocType : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class origRefNbr : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class releasedOrPrebooked : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class taxCalcMode : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class approved : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class rejected : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class dontApprove : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class employeeWorkgroupID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class employeeID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class workgroupID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class ownerID : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyInitDocBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class initDocBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class displayCuryInitDocBal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class isMigratedRecord : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDiscountedDocTotal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class discountedDocTotal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDiscountedTaxableTotal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class discountedTaxableTotal : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class curyDiscountedPrice : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class discountedPrice : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class hasPPDTaxes : IBqlFieldIBqlOperand
        {
        }
 
        public abstract class pendingPPD : IBqlFieldIBqlOperand
        {
        }
    }

and as result, I've got two filters splitted. 

No Comments

Add a Comment