Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

How to get filters from page

(0) ShareShare
ReportReport
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

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,148 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 47 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 21,091 Super User 2024 Season 1 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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans