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