web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Using SetFilter With two Filter Conditions

(0) ShareShare
ReportReport
Posted on by 980

Hi,

Need a little piece of information on using SetFilter for a page by using multiple filters.

For E.g. in the jobs List i want to filter the Jobs page using Blocked and the Status Field through an extension.

How could I achieve this,

my present code of using SetFilter not working using two fields one after the other,it somehow overwrites the first condition to the second consition.

 trigger OnOpenPage()
    var
        JobBlocked: Enum "Job Blocked";
        JobStatus: Enum "Job Status";
    begin

        Rec.SetFilter(Rec.Status, '<>%1', JobStatus::Completed);
        Rec.SetFilter(Rec.Blocked, '%1', JobBlocked::" ");



    end;
Thanks
Indira
I have the same question (0)
  • Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    You can use filters on multiple fields. Can you share your whole code ?

    Are you sure you don't have other extension that affecting your code.

  • Indira88 Profile Picture
    980 on at

    hi Teddy,

    This is the code in the Job List PageExtension:

       trigger OnOpenPage()
        var
            JobBlocked: Enum "Job Blocked";
            JobStatus: Enum "Job Status";
        begin
            Rec.SetFilter(Rec.Blocked, '<>%1', JobBlocked::All);
            Rec.SetFilter(Rec.Status, '=%1&=%2&=%3&=%4', JobStatus::Planning, JobStatus::Open, JobStatus::Quote, JobStatus::Completed);



        end;
    it does not work however
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Are you sure you have records with those filters ? can you place same filter on a page and view the records ?

  • Indira88 Profile Picture
    980 on at

    yes I have records the problem is in the filter pane the filter parameters do not show when I am adding the secnd filter ,with the first filter it works fine.I need records where( Status<> Completed and Blocked = All)

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    What do you mean by filter parameters are not available when adding the second filter

  • Indira88 Profile Picture
    980 on at

    So Whwnever I am adding a second filter condition in the filter pane the fields are showing without the filters working which means the fields on the filter pane have nothing checked or unchecked.

    Regards,

    Indira

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Can you please send us the screenshot of those?

  • Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    Are you sure you don't have two page extensions modifying the same page ?

  • Indira88 Profile Picture
    980 on at

    to Clarify I do have two different page extensions but have not used a filter in the previous extension

  • Verified answer
    Indira88 Profile Picture
    980 on at

    I have Set a different filter now that populates based on the previous two conditions,to avoid using two conditions.In the pane shown below the filters Status and Blocked show but how it is showing in this screenshot with all the conditions it does not show the conditions when two filtes are added.pastedimage1626812964598v2.pngI am not able to give you the screenshot xctly because I have reversed the code with the solution stated above.

    Thanks,

    Indira

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans