SQL Server Developer Center > SQL Server Forums > SQL Server Reporting Services > how to filter a tablix based on multiple condition ?

Discussion how to filter a tablix based on multiple condition ?

  • Friday, March 05, 2010 11:16 AM
     
     
    I am using report builder 2.0 for reporting and I am trying to filter my tablix object
    What I need to do is to filter my records in that table in order that in extract records on ly based on condition for a particular field.

    For example I want to show only records when the TagName field is equal to "string1" or "string 2"

    To do that I open my tablix property and then select the filter tab
    Then I add a filter based on my TagName field and set the operator to =
    Then in value I add : ="string1"

    Runing the report like this is working correctly and I have only record where my filter apply

    Then I add a new filter with = operator set with value : "string 2"

    Running my report now do not show anymore records so I guess the filter apply here a AND condition when there is multiple filter enter.

    IN my case I need to apply a OR condition on those 2 strings

    how can I do that ?

    thanks for help
    regards
    serge
    Your experience is build from the one of others

All Replies

  • Sunday, March 14, 2010 11:12 PM
    Owner
     
     
    There are several ways of doing this.  I'd start with trying this approach:

    Filter expression:    =(Fields!TagName.Value = "string1" OR Fields!TagName.Value = "string2")
    Filter operator:        =
    Filter value:            =true


    HTH,
    Robert
    Robert Bruckner   http://blogs.msdn.com/robertbruckner
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Wednesday, March 17, 2010 4:49 PM
     
     
    Thanks for your reply.

    I still have a question based on filtering.
    When you build a dataset for you report which return a set of data.
    Then you need to have this dataset result in deifferent place of your report but with different filter apply

    For example:

    - Table 1 is bind to this data set but show only data based on Filter 1
    - Table 2 is bind to this same data set but shows only data based on Filter 2.

    When doing so does the second dataset apply to second table need to request again the data from databased and then apply the seocnd filter or does it used from a caching mecanism ?

    In other words, does 2 same dataset with different filter apply on the report are handle has 2 calls to the database ?

    thnaks for help
    serge
    Your experience is build from the one of others
  • Wednesday, March 17, 2010 10:52 PM
    Owner
     
     
    No, the dataset query for report datasets used in the report body is executed only once, regardless of how many different tables, charts, etc. with different filters are populated by that dataset.

    HTH,
    Robert
    Robert Bruckner   http://blogs.msdn.com/robertbruckner
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Thursday, March 18, 2010 8:31 AM
     
     
    Ok,

    So it means that with the same dataset I can populate 2 tables with different filter and no callback to teh server is needed, great.

    Is there a way on the data set to filter it with the SQL LIKE keyword ?

    I have try the following but does not work and return filter error:

    Filter = Exp

      =myField.Value LIKE 'rpt%'

    Operator : LIKE

    Value = True

    Any idea ?

    regards
    serge
    Your experience is build from the one of others
  • Friday, March 19, 2010 2:57 AM
    Owner
     
     

    When using the LIKE filter inside a report, you have to use the VB-syntax for like-comparison (not the T-SQL syntax):

    Filter expression: =Fields!A.Value
    Filter operator:    LIKE
    Filter value:        rpt*
    alternatively:      ="rpt*"

    Thanks,
    Robert

     


    Robert Bruckner   http://blogs.msdn.com/robertbruckner
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Friday, March 19, 2010 10:15 AM
     
     

    Thnaks robert

    serge


    Your experience is build from the one of others
  • Friday, March 19, 2010 6:06 PM
    Owner
     
     
    Btw, the VB syntax for the LIKE keyword is covered here: http://msdn.microsoft.com/en-us/library/swf8kaxw(VS.71).aspx
    Robert Bruckner   http://blogs.msdn.com/robertbruckner
    This posting is provided "AS IS" with no warranties, and confers no rights.