Hi, Readers.
Today I would like to briefly share a question I saw yesterday in the Dynamics 365 Community, Page – Filter Reset – after printing (dynamics.com).
What is the problem? The developer wants to print the selected assembly orders. Here’s his code.
We have discussed Can we change default options/filters on the request page of Report??? before, he used one of these methods. But there was a problem. When he finished printing and returned to the list page, the list page only showed the row he had just selected (Filters are automatically added). Why? This actually has nothing to do with the printed report, but has to do with the following two factors.
1. Page.SetSelectionFilter(var Record) Method: Notes the records that the user has selected on the page, marks those records in the table specified, and sets the filter to “marked only”.
System-defined variable | Description |
---|---|
Rec | When a record is modified, this variable specifies the current record, including the changes that are made. |
Let’s look at a simple example. Add a action to the Item List page to count the selected items.
You will find that the page has been filtered at this time.
Test video:
So how do we solve this problem? It’s simple. Instead of using the system variable, Rec, declare a new variable.
Great.
Test video:
And, there is another simple way, which is just to reset the filters of the Rec at the end. This results in the same thing as declaring a variable.
More details: Record.Reset() Method
PS: Dynamics 365 Business Central: How to remove or cancel only one filter (Not Reset All filter)
If the variable you declare is a temporary table, please note that you need to insert data in advance.
Give it a try!!!😁
END
Hope this will help.
Thanks for reading.
ZHU
コメント