When running a report, sometimes we want the user to be able to filter on something that is not a field in a table. This recipe will show you how to add a filter to the request page for this purpose.
Create a report by following the Creating an RDLC report recipe.
Reopen the report in the designer mode and add the following global variables:
Name
Type
Length
CustomerNoFilter
Code
250
Navigate to View | Request Page (Alt + V, A).
Add the following lines in the page designer:
Type
SubType
SourceExpr
Name
Container
ContentArea
MainContainer
Group
Group
MainGroup
Field
CustomerNoFilter
Customer No. Filter
Add the following code to the
OnPreDataItem
trigger for thecustomer
data item:IF CustomerNoFilter <> '' THEN SETFILTER("No.", '%1', CustomerNoFilter);
Save and close the report.