Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6899
  • Last Modified:

MSSQL Reporting Services - Filtering data in a table

All;

I have an issue in tyring to place a filter on a table in my report.

I have one dataset that i want to filter and display serveral times in one report.  The query is complicated and somewhat slow(yes i am working on optimizing it), so i want to pull it once, and then use it in 4 different tables in my report.
The first table, will be unfiltered, the others will be filtered by one of the fields in my dataset that returns an int datatype, none of the values are null, I checked.

I tried following the instructions here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RShowto/htm/hrs_designer_v1_3diq.asp,
but it doesn't work.

My filter expression is =Fields!myField.Value>=80.

When i preview the report, it returns no build errors or warnings, but i get  this dialog:
------------------------------------------------------------------------------------------------
Processing Errors
An error has occurred during the report processing.
The processing of filter expression for the table 'table1' cannot be
performed.  The comparison failed. Please check the data type returned by the
filter expression.
-----------------------------------------------------------------------------------------------
What am i doing wrong???
This is driving me nuts...

Thank you;
0
cubical10
Asked:
cubical10
  • 3
  • 2
1 Solution
 
simon_kirkCommented:
Try this:

Expression: =Fields!myField.Value
Operator: >=
Value: =80

If it's still complaining about datatype mismatch, change the expression to:

=CInt(Fields!myField.Value)
0
 
cubical10Author Commented:
Thanks for the feed back.

What i had for my original post:
Expression:=Fields!myField.Value
Operator: >=
Value: 80

If I change the expression to Fields!myField.Value, without the leading =, the report runs without the error, but it does not filter.  
If I change the value to =80 from 80 i go back to the original error.  
Using CInt(Fields!myField.Value) does not error, but does not filter.  
=Cint(Fields!myField.Value) errors out.

BTW, i added CONVERT(int,myField) to my SQL statement just to make sure that i am returning an int field, no change...


0
 
simon_kirkCommented:
That's odd.  I tried setting a report very similar to yours and mine filters ok.  I even used the convert function in my SQL statement as well.

Filter I used:
Expression: =Fields!myField.Value
Operator: >=
Value: =80

Maybe you are getting a Null value for Fields!myField.Value in some of your records?  This could then be the mismatch that it's going on about.  You could find this out by adding a criteria against the field in the dataset to only select records where Fields!myField.Value is null ?
0
 
cubical10Author Commented:
OK;

I got it, picky app this is...
Expression: =CInt(Fields!myField.Value)
Operator: >=
Value: =80

Thanks...
0
 
simon_kirkCommented:
Got there eventually!  What some people deem as a 'learning-curve' :-)
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now