How To Filter Add Some Info To Filter
Hello everybody.
Today I want to share notice of how to work with processing screens.
But of course not in very standard situation. One of my clients requested me the following: he wanted at processing screen to select some items in screen in part 1, then monitor
results in part two, and see some totals in part three.
As you understand it's not easy to ahcieve this goal only with help of selectors. It is possible with usage of delegates in Acumatica and with usage of it's cache.
Initial initialization of page was the following:
[Serializable] public class RRCashRequestProcessor : PXGraph<RRCashRequestProcessor> { public PXCancel<CreatePaymentFilter> Cancel; public PXFilter<CreatePaymentFilter> FilterApprover; [PXFilterable] public PXFilteredProcessingJoin<UsrRRCashRequest, CreatePaymentFilter, InnerJoin<UsrRRCashBudgetItem, On<UsrRRCashBudgetItem.itemRefNbr, Equal<UsrRRCashRequest.budgetItemRefNbr>>>, Where<UsrRRCashRequest.branchID, Equal<NonExistentBranch.nonBranch>>> CashRequests; public RRCashRequestProcessor() { CashRequests.SetProcessDelegate(RequestCasheList); }
And then I've got a problem, how to put some data into FilterApprover DAC from CashRequests DAC if to keep in mind that top of the screen is used for making bottom.
For such cases it's useful to use this.Caches object of graph or Base.Caches if you work with extension graphs. Take note how I filled Total Generated value of column:
protected IEnumerable filterApprover() { PXCache cache = this.Caches[typeof(CreatePaymentFilter)]; if (cache != null) { CreatePaymentFilter filter = cache.Current as CreatePaymentFilter; if (filter != null) { var cashRecs = CashRequests.Select().Select(a => a.GetItem<UsrRRCashRequest>()); filter.TotalGenerated = cashRecs.Sum(a => a.Amt ?? 0); } } yield return cache.Current; }