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

Limiting the RequestFilterFields to a subset of records

(4) ShareShare
ReportReport
Posted on by 683
I am building an SSRS report in BC that lists open Sales Orders and Line Items for a customer range.  The Customer range is based on new field in the Customer page called "Customer Location", which has its own table and list.  The report should only show customers with a Location starting with 'ABC'.
 
In the Customer Data item, I am restricting the customers returned for this report like this:
 dataitem(CU; Customer)
        {
            DataItemTableView = where("Location No." = FILTER('ABC*'));
            RequestFilterFields = "Location No.";
            PrintOnlyIfDetail = True;
            column(Customer_Nbr; "No.")
            {
            }
            column(Location_No; "Location No.")
            {
            }
        }
 
The Location No. field is a Filter on the report, but it returns the entire list of Customer Locations as below:
 
Is there a way to get the Report Filter to only show the Locations starting with 'ABC' to match the list of Customers included in the report?
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,593 Super User 2025 Season 2 on at
    This cannot be done using RequestFilterFields, you need to add a new field on the request page and then do some filtering.
    Or you can use a security filter to completely restrict user access to these values.
     
    Hope this can give you some hints.
    Thanks.
    ZHU
  • Gerardo Rentería García Profile Picture
    25,225 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Dynamics 365 Business Central: Can we change default options/filters on the request page of Report??? | Dynamics 365 Lab

     

    Best Regards
    Gerardo

  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,439 Super User 2025 Season 2 on at
    In Business Central SSRS reports, the RequestFilterFields property only controls what fields users can filter on but does not restrict the values available in the filter selection dropdown.
  • Khushbu Rajvi. Profile Picture
    20,439 Super User 2025 Season 2 on at
    Apply below code and check:
     
    requestpage
        {
            layout
            {
                area(Content)
                {
                    group(GroupName)
                    {
                        field("Filtered Location"; LocationFilter)
                        {
                            ApplicationArea = All;
                            TableRelation = Location.Code WHERE(Code = FILTER('ABC*'));
                        }
                    }
                }
            }
        }
     
     
     
    var
           
     LocationFilter: Code[20];
    Location: Record Location;
     
     
     
    trigger OnPreReport()
        begin
            IF LocationFilter <> '' THEN
                Location.SETFILTER(Code, LocationFilter)
            ELSE
                Location.SETFILTER(Code, 'ABC*');
        end;
     
     
     
     
     
     
  • Suggested answer
    ME-31032107-0 Profile Picture
    683 on at
    , your post worked perfectly for what I needed, thanks!!
  • ME-31032107-0 Profile Picture
    683 on at
    , actually I am now realizing that while your code does provide the filtered location list, if I choose a single location in the filter, all the Locations still appear in the output.  The report needs to only show the customer data for the selected Location.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,439 Super User 2025 Season 2 on at
    Hi,   please try below code
     
    report 50710 Customerr
    {
        UsageCategory = ReportsAndAnalysis;
        ApplicationArea = All;
        Caption = 'Customer Report';
        DefaultRenderingLayout = LayoutName;
     
        dataset
        {
            dataitem(Customer; Customer)
            {
                column(ColumnName; "No.")
                {
     
                }
                column(Name; Name)
                {
     
                }
                column(Address; Address)
                {
     
                }
                column(Location_Code; "Location Code")
                {
                }
                trigger OnPreDataItem()
                begin
                    if LocationFilter <> '' then
                        SETRANGE("Location Code", LocationFilter)
                    else
                      CLEAR("Location Code");
                end;
            }
        }
     
        requestpage
        {
            AboutTitle = 'Teaching tip title';
            AboutText = 'Teaching tip content';
            layout
            {
                area(Content)
                {
                    group(GroupName)
                    {
                        field(Filter; LocationFilter)
                        {
                            ApplicationArea = All;
     
                            TableRelation = Location.Code WHERE(Code = FILTER('ABC*'));
                        }
                    }
                }
            }
        }
     
        rendering
        {
            layout(LayoutName)
            {
                Type = RDLC;
                LayoutFile = 'mySpreadsheet.rdl';
            }
        }
     
        var
            LocationFilter: text;
    }
  • Verified answer
    Khushbu Rajvi. Profile Picture
    20,439 Super User 2025 Season 2 on at
    Here is the OutPut. I have checked it. 
     
     
    With fILTER
     
    Without Filter: 
     
     
  • ME-31032107-0 Profile Picture
    683 on at
    , thank you, that works much better.

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,151

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans