An object reference is required for the non-static field, method, or property PX.Data.PXSelectBase Acumatica DAC Select in Acumatica

Hello everybody,

today I want to share how to fight with error like 

Error 22 An object reference is required for the non-static field, method, or property 'PX.Data.PXSelectBase<Acumatica DAC>.Select(params object[])' bla bla bla

As usually it means that you try to use this in selector of Extension class. Just replace this at Base or Base2 and your problem will go away.

for example 

CR.Location customerLoc = PXSelect<CR.Location, Where<CR.Location.bAccountID, Equal<Required<CR.Location.bAccountID>>, 

                            And<CR.Location.locationID, Equal<Required<CR.Location.locationID>>>>>.Select(this, customer.BAccountID, customer.DefLocationID);

should be 

CR.Location customerLoc = PXSelect<CR.Location, Where<CR.Location.bAccountID, Equal<Required<CR.Location.bAccountID>>, 

                            And<CR.Location.locationID, Equal<Required<CR.Location.locationID>>>>>.Select(Base, customer.BAccountID, customer.DefLocationID);

and your code will be compiled again

2 Comments

  • Dana said

    Hi,
    I am trying to get the number of rows that would be returned from the CR.Location.bAccountID table when a user selects a Vendor Id on the Purchase Order screen. If there is more than one location associated with the Vendor Id then I want to prompt the user to select a location other than the default.

  • docotor said

    Tell me please screenID.
    In which form you want to prompt user to select location? Pop up window? Or some control at form?

Add a Comment