Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:34:55+00:00 2026-06-12T09:34:55+00:00

My particular, specific issue is probably too localized, but the general question I’m about

  • 0

My particular, specific issue is probably too localized, but the general question I’m about to ask is something I’m sure others will ask and have wondered:

General question: In Sql Server Reporting Services, is it possible to apply a filter to a report in code? If not, is it possible to use branching in the report filter based on the value of a variable, and can you point me to documentation or explain how to do it.


My specific example follows, to expand on what I mean by the above, in case I worded it badly:

I’m learning SSRS and the docs and Google are coming up short.

The desired effect is that we have a report based on an incident tracking system. In this system, we have various teams that can track incidents: IT Ops, Development, Security, etc. Each of these teams have team members assigned.

  • We have a base report that displays ALL incidents.
  • We have added a boolean parameter named “LimitByTeam”, which produces a CheckBox on the report as you’d expect.
  • We have added a String parameter that accepts multiple values. The allowed values come from a data set that lists the teams. This has added the expected drop-down list to the report, allowing users to select one or more teams.
  • We added a dataset that contains team and team member.

If the CheckBox is NOT selected, we want to display all incidents. (The default)

If it IS selected, we want to have the report to filter based on the login ID of the person who created the incident ticket.

Were I to do this in SQL, I’d do it as

Select 
   (ticket fields) 
From 
   Table 
WHERE TicketCreator IN (
             Select LoginId FROM TeamMembersTable 
             WHERE TeamName in ('IT Ops', 'Developers'))

In SQL, or in VB, etc, this would be simple.

In SSRS I’m not figuring out quite how to do this. I’ve gotten as far as figuring out that I can use Custom Code to do more complex logic using VB (and it appears to be VB.NET. HOORAY! Familiar territory)

So I’ve added custom code and verified that I can read the value of the report parameter, but I can’t figure out for the life of me how to apply a filter if the parameter value is True. Here’s what I’ve got.

Public Sub ApplyTeamFilter() 

    ' Report.Parameters("LimitByTeam") is a 
    ' boolean report parameter that I'm able to access
    ' so I've got the IF statement worked out


    If Report.Parameters("LimitByTeam").Value = True Then
                 ' Pseudo-code - I'm looking for something like Report.Filters.Add(filterstatement)
                 ' Alternatively a way to change this to a function to return a list of items from 
                 ' the Team MembersTable table and use it in a custom expression.
     End If
End Sub

The problem is that I can’t seem to find a Filters property on the Report object, or any method that lets me find it. Since I couldn’t find it there, I expanded my search to everything in this section of the MSDN library and can’t find it, or anything even remotely resembling a way to do what I’m attempting.

I’m also trying to do something like this because I think I see a way to use this function:

Public Function IsLoginIdInTeam(ByVal LoginId as String, byVal Team As String) As Boolean

    '  Report.Parameters("LimitByTeam") is a 
    ' boolean report parameter that I'm able to access
    ' so I've got the IF statement worked out


    If Report.Parameters("LimitByTeam").Value = False Then
        Return True ' Default
    Else
        ' Access the TeamMembers table and look for a match
                ' Something like 
                ' Convert.ToBoolean(Report.DataSets!TeamMembers.Compute(Count, "TeamName = '" & Team & "' AND LoginId = '" & LoginId & "'")

     End If
End Function

But I can’t figure out how to access the Data Sets in the report, either, much less the syntax for interacting with them. The pseudocode works with a System.Data.DataTable, but I suspect SSRS DataSets are a different beast.

Am I missing something blindingly obvious? Should I be giving up on filtering this way in the report, and try another track, like changing the original query in the DataSet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:34:56+00:00Added an answer on June 12, 2026 at 9:34 am

    I’m not a huge fan of boolean parameters in SSRS (or BIT in SQL for that matter.) You can’t write things like

    WHERE @MyBool OR @MyOtherBool
    

    It needs to be

    WHERE @MyBool = 1 or @MyOtherBool = 1
    

    So if I have an SSRS report with a boolean called MyBoolParam and a multivalue text parameter called MyMultiSelectTextParam , a SQL query like this will work:

    SELECT 
       MyField,
       MyOtherField
    FROM
       MyTable t
    WHERE
       @MyBoolParam = 1
       OR
       t.MyField IN ( @MyMultiSelectTextParam)
    

    (My preferred alternative to boolean parameters is actually a string with possible values, but it would be handled in the query in the same way.)

    If you can’t easily change your SQL query (such as using a third party SP) then you can also accomplish the same thing by adding a filter to the SSRS DataSet. Right click on the DataSet in the Report Data pane and look at the Dataset Properties. The Filters pane will let you add criteria that are evaluated for each row. I haven’t used these as much with multivalue parameters, but the IN Operator should work for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a particular application that needs to calculate something very specific, and while
This question is specific to the iMacros suite in particular. What is the best
I'm having an issue with RVM. In general I use project specific gemsets; however,
I'm sure it's something obvious, but I'm pretty stuck here. I have a LAMP
Consider the following general issue before I go to the specific problem: You use
I have a specific requirement that all children of a particular JComponent have double
I have a data frame where one particular column has a set of specific
I've got an issue that was wondering if could be solved in a particular
I know there is this question that is very similar, but I wanted to
This is a more specific question to follow up on [another question that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.