Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

How to get filters from page

Posted on by 119

Hello everyone,
I want to change data in VAT Entry table, but I want to change data only on current filtered records. For example: After I filtered vat entries on posting date, document type and any other filter, I want to change data on  only for that filtered records. 
Do you know any way how to get current filters (not selected, just filtered), from page in code? I don't want to limit my code on 1,2,3... filters?
Thank you

Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 68,842 Super User 2024 Season 2 on at
    RE: How to get filters from page

    Hi, hope the following helps.

    How to get a filter for the selected records on any page (For example, ‘1..3|6’)

    https://yzhums.com/27561/

    Thanks.

    ZHU

  • Suggested answer
    Bilal Haider Profile Picture
    Bilal Haider 43 on at
    RE: How to get filters from page

    Hi,

    As I understand you want to get the filters from current page.

    There are two functions that you can use.

    Rec.GetFilter(Field)

    It returns the filter string on the field you mentioned.

    Rec.GetFilters

    It returns all the filters. with the field names

    For details

    learn.microsoft.com/.../getfilters-function--record-

  • Haris Korac Profile Picture
    Haris Korac 119 on at
    RE: How to get filters from page

    Hello,

    Posting date only just example.

    I create this action:

    trigger OnAction()

    var

         VATEntry: Record "VAT Entry";

         ChangeDATA: Codeunit ChangeDATA_VSL;

    begin

         VATEntry := Rec;

         Clear(VATEntry);

         CurrPage.SetSelectionFilter(VATEntry);

         if VATEntry.FindSet() then

               repeat

                     ChangeDATA.setBaseandOtherFields_VSL(VATEntry);

               until VATEntry.Next() = 0;

    end;

    But I don't want to use selection filter. I want to use filters from page. Is that possible?

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,995 Moderator on at
    RE: How to get filters from page

    Hi,

    its not recommended to change anything on Posted data, but yes if you want to, you can create a Processing only report, provide the filters in there and write the logic to change the data, if you allowed to.

    Thanks.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans