Hello,
I am trying to create a control at the bottom of pages like Posted Sales Invoice Lines, that would sum the amount fields, and that amount updates with what filters you apply to the page. Kind of like the controls at the bottom of the payment journal. What would be the proper way to do so? I was able to put the group, and fixed field that is a variable type decimal. But thats as far as I was able to get.
Setselectionfilter Documentation:
•Copies the current filters that are set in all filter groups. WHEN you select MORE than one record.
So, you can't use it. The real problem heres is that Bussines Central doesn't has an event called OnAfterPageUpdate, and we can't us OnAfterGetRecord because BC call it when the user do clic on blanc filter but having other live filters...
and there is no event for when the filters change.
complicating it...
So, if you want copy the filters you can do it, with Var.Copyfilters(rec)
But when? Using a button ? for that better what Madest said.
Okay. Excuse my ignorance as I’ve only used it to update records the user has highlighted.
Currpage.setselectionfilter(ItemRec)
This would filter the ItemRec variable to be whatever the user applied as filter, not just what they have highlighted/selected in the list?
If this works it will truly be a win to not have to write a bunch of reports for the users.
The function currpage.setselectionfilter get back the user filter on a record variable.
Check the Micrisoft documentation
Thank you for the response, however, say they go to the posted sales invoice lines page, and set a filter of location code is <value> or apply a date range. I would want whatever filters they apply to also filter my total field in the group below the repeater. I guess that’s where I am stuck, utilizing the users filters to filter the field.
Possibly the best solution would be and more powerful:
On the page, in the OnAfterGetCurrentRecord event, you have to add the following:
CurrPage.SetSelectionFilter (rSalesInvoices);
rSalesInvoices.CALCSUMS (Field);
dAmountSum: = rSalesInvoices.Field;
With this you add what you select and it is more practical. (You can select everything with the upper left corner)
I hope it helps.
Greetings.
I am able to through VS Code Extension deployment to our Test DB. However, I tried what you suggested and could not get it to work. Could you possibly give me a short example on how you would do it, utilizing the filters the user applied to the page?
You'll need some devlopment capabilities to do this.
In the page designer, you can create a new group after the repeater and put a variable based field in.
You will have to set manually the caption of this field and to calculate the value with code for exemple in the "OnAfterGetRecord" event with a loop summing value under the particular conditions you want.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156