Solved

How to restrict record in toolbar navigation


Userlevel 2
Badge

Dear Team,

 I have created duplicate Screen and use the same graph and DAC, I want show show only related screen records when i click toolbar attached image below.

 

When navigate through toolbar it shows both screen records. how to filter record here. I have filter separate GI & Selector 

Thanks,

Arun.

icon

Best answer by vardan22 25 October 2023, 12:25

View original

14 replies

Userlevel 4
Badge +1

Hi @arun83 

Can you try to give Where Condition (CreatedByScreenID=YourScreenID) for RefNbr Selector.

Thanks.

Userlevel 2
Badge

Hi @arun83 

Can you try to give Where Condition (CreatedByScreenID=YourScreenID) for RefNbr Selector.

Thanks.

Its not working with different scenario. 

Userlevel 7
Badge +17

@arun83  Have you tried loading the Documents in the REF NBR. field by adding a ScreenID condition by writing the Cache_Attached Event?

if yes, can you please share it here, so that we can review it and suggest if any code modifications are required?

Badge +11

Would a PXRestrictor work on the selector? It may have the same drawbacks as filtering the Selector. Maybe it would be helpful to know what situation that is a problem for.

Userlevel 7
Badge +17

Yes, It should work with Cache_Attached with PXRestrictor.

 

Userlevel 2
Badge

My scenario is i have 3 duplicate screen for different purpose & also i have Boolean flag to differentiate record from each screen and filter GI.  but when it comes to RefNbr i can filter also but when i navigate record using toolbar it shows other screen records also. 

Userlevel 2
Badge

my navigation still not working. It filters only selector. Tollbar still showing other module record 

 

  [PXDBString(15, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
  [PXDefault()]
  [PXUIField(DisplayName = "Reference Nbr.", Visibility = PXUIVisibility.SelectorVisible, TabOrder = 1)]
  [APInvoiceType.RefNbr(typeof(Search2<Standalone.APRegisterAlias.refNbr,
  InnerJoinSingleTable<APInvoice, On<APInvoice.docType, Equal<Standalone.APRegisterAlias.docType>,
  And<APInvoice.refNbr, Equal<Standalone.APRegisterAlias.refNbr>>>,
  InnerJoinSingleTable<Vendor, On<Standalone.APRegisterAlias.vendorID, Equal<Vendor.bAccountID>>>>,
  Where<Standalone.APRegisterAlias.docType, Equal<Optional<APInvoice.docType>>,
  And2<Where<Standalone.APRegisterAlias.origModule, NotEqual<BatchModule.moduleTX>,
  Or<Standalone.APRegisterAlias.released, Equal<True>>>,
  And<Match<Vendor, Current<AccessInfo.userName>>>>>,
  OrderBy<Desc<Standalone.APRegisterAlias.refNbr>>>), Filterable = true, IsPrimaryViewCompatible = true)]
  [APInvoiceType.Numbering()]
  [PXFieldDescription]
  [PXRestrictor(typeof(Where<APRegisterExt.usrRental, Equal<Current<APRegisterExt.usrRental>>>), "Show record by rental flag")]
  protected virtual void APInvoice_RefNbr_CacheAttached(PXCache cache)
  {

  }
 

Userlevel 4
Badge +1

You have to change the PXView for the header part of Requisitions screen. To do that you need to override the Initialize() method in the your graph extsnsion created from RQRequisitionEntry graph.
Below example will display records only if priority is Normal(this is additional condition added into the base PXSelect for header part).

public class RQRequisitionEntry_Extension : PXGraphExtension<RQRequisitionEntry>
{
public override void Initialize()
{
base.Initialize();
var command = new PXSelectJoin<
RQRequisition,
LeftJoinSingleTable<Customer,
On<Customer.bAccountID, Equal<RQRequisition.customerID>>,
LeftJoinSingleTable<Vendor,
On<Vendor.bAccountID, Equal<RQRequisition.vendorID>>>>,
Where2<
Where<Customer.bAccountID, IsNull,
Or<Match<Customer, Current<AccessInfo.userName>>>>,
And2<Where<Vendor.bAccountID, IsNull,
Or<Match<Vendor, Current<AccessInfo.userName>>>>,
And<RQRequisition.priority, Equal<int1>>>>>(this.Base);
Base.Views["Document"] = new PXView(Base, false, command.View.BqlSelect);
}
}

 

Badge +11

@vardan22 - What’s the difference (pros / cons) between altering the view 👆🏼 and redefining it? 

Userlevel 4
Badge +1

@vardan22 - What’s the difference (pros / cons) between altering the view 👆🏼 and redefining it? 

@darylbowman -  good question.  I'm pretty sure one of the first problems could be not correct current and cached records.
I've never checked, but here is my thoughts:

if redefining is mean to create a new PXSelect with the same name of view in the extension graph , I guess it will work(for small customizations) but it can cause problem when the same graph has more then one or two graph extension(because each of extensions will use view from the base graph). I'm pretty sure during the time it will have problem with current and cached records.

if redefining is mean to create an method with view name that will return IEnumerable that I can say this will not work for  header part of entry type of graphs.

Badge +11

It seems like your code is altering the view in a graph extension as well though. Are you saying that this change will be maintained across multiple graph extensions? Or would you need to redefine in each graph extension?

Userlevel 4
Badge +1

It seems like your code is altering the view in a graph extension as well though. Are you saying that this change will be maintained across multiple graph extensions? Or would you need to redefine in each graph extension?

it changed the view from the base graph views collection ”Base.Views”, so I think it make sense to work for each extension, but I never checked it, so this is just my logical conclusion.

Badge +11

Ah, got it.

Userlevel 2
Badge

You have to change the PXView for the header part of Requisitions screen. To do that you need to override the Initialize() method in the your graph extsnsion created from RQRequisitionEntry graph.
Below example will display records only if priority is Normal(this is additional condition added into the base PXSelect for header part).

public class RQRequisitionEntry_Extension : PXGraphExtension<RQRequisitionEntry>
{
public override void Initialize()
{
base.Initialize();
var command = new PXSelectJoin<
RQRequisition,
LeftJoinSingleTable<Customer,
On<Customer.bAccountID, Equal<RQRequisition.customerID>>,
LeftJoinSingleTable<Vendor,
On<Vendor.bAccountID, Equal<RQRequisition.vendorID>>>>,
Where2<
Where<Customer.bAccountID, IsNull,
Or<Match<Customer, Current<AccessInfo.userName>>>>,
And2<Where<Vendor.bAccountID, IsNull,
Or<Match<Vendor, Current<AccessInfo.userName>>>>,
And<RQRequisition.priority, Equal<int1>>>>>(this.Base);
Base.Views["Document"] = new PXView(Base, false, command.View.BqlSelect);
}
}

 

I tested this code work as expected, 

Thanks,

Arun.

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