Hi, Readers.
Today I would like to talk about a question I was asked recently, can we set a default “Filter totals by” (FlowFilters) on lists.
As you might know, on lists, you set filters by using the filter pane. To display the filter pane for a list, choose the drop-down arrow next to the name of the page, and then choose the Show filter pane action. Alternatively, select Shift+F3. For example, on the Item List (31, List) page:
Some lists that display calculated fields, such as amounts and quantities, include the Filter totals by section where you can adjust various dimensions that influence calculations. To add a filter, choose the + Filter action. Then, type the name of the field that you want to filter the list by or pick a field from the drop-down list. More details: Setting filters on lists
Filters in the Filter totals by section are controlled by FlowFilters on the page design.
PS: How to export all fields in all tables in Dynamics 365 Business Central
For example, “Location Filter”:
For example, the following example only shows the inventory of the EAST location.
After clicking the value of Flowfield to drill down, you can see that the opened page has automatically added a filter.
More details: FlowFilters overview
Let’s look at another example. Displays the balance for the current year on the Chart of Accounts (16, List) page.
Same as in the Item example.
So can we aset a default “Filter totals by” (FlowFilters) when opening the list? Yes. This is not difficult. In fact, Flowfilter is also a field on the table. This is the same as adding a default filter. Let’s look at two examples:
1. Item List (31, List): Location Filter= EAST
Test code:
pageextension 50112 ItemListExt extends "Item List"
{
trigger OnOpenPage()
begin
Rec.SetFilter("Location Filter", 'EAST');
end;
}
2. Chart of Accounts (16, List): Date Filter= Current year
Test code:
pageextension 50113 ChartOfAccountsExt extends "Chart of Accounts"
{
trigger OnOpenPage()
var
ThisYearStartDate: Date;
ThisYearEndDate: Date;
begin
ThisYearStartDate := CalcDate('<-CY>', Today);
ThisYearEndDate := CalcDate('<CY>', Today);
Rec.SetFilter("Date Filter", '%1..%2', ThisYearStartDate, ThisYearEndDate);
end;
}
Test video:
PS: Dynamics 365 Business Central: Reset/clear all Filters to defaults on a list
If you don’t want users to remove this filter, you can refer to the following method:
Dynamics 365 Business Central: How to make some filters mandatory on the list page (users can not change or remove)
Very simple, give it a try!!!😁
PS: Dynamics 365 Business Central: FlowFields (Sum, Average, Exist, Count, Min, Max, Lookup)
END
Hope this will help.
Thanks for reading.
ZHU
コメント