Filter expression (Like or In)
First off, my issue is similar to this one:
http://social.msdn.microsoft.com/Forums/is/sqlreportingservices/thread/4da9feab-5788-4504-821f-2668a5612b6b
I have two date fields and a dropdown in SSRS 2008. Based on the dates selected, the dropdown is populated with a list of relative data (in this case, carriers for shipments). That part works fine. What doesn't work is the actual
filtering based on what is selected.
If I pick multiple carriers, it only shows data for the very first selected one in the list. It had a filter in it as follows:
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.Value(0)
I have tried a ton of combinations and can't get this working, what should the filter actually be?
July 5th, 2012 3:36pm
=Join(Parameters!Carrier.Value)
http://msdn.microsoft.com/en-us/library/ms157328.aspx
Brad Syputa, Microsoft Reporting Services This posting is provided "AS IS" with no warranties.
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2012 4:11pm
I just tried that with both the 'In' and 'Like' operators and get no results when I select from the list.
July 5th, 2012 4:26pm
Hi There
Thanks for your posting.
I am assuming that you have multivalued parameter.I would say tha you can pass
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.Value
Many thanks
Syed
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.Value
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2012 4:46pm
Hi There
Thanks for your posting.
I am assuming that you have multivalued parameter.I would say tha you can pass
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.Value
Many thanks
Syed
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.Value
Tried that just now and also get zero results. You're right on the multivalue parameter though. It seems to make sense that my initial value of =Parameters!Carrier.Value(0) would only show the first record if it's zero based, but I don't know why
it's not working with your suggestion.
July 5th, 2012 4:51pm
Hi There
Thanks for your posting. Is your Value is exactly same as Fields!Carrier or your label is is exactly same as Fields!Carrier
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.value
Many thanks
Syed
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2012 5:00pm
Hi There
Thanks for your posting. Is your Value is exactly same as Fields!Carrier or your label is is exactly same as Fields!Carrier
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.label
Many thanks
Syed
July 5th, 2012 5:05pm
Hi There
Thanks for your posting. Is your Value is exactly same as Fields!Carrier or your label is is exactly same as Fields!Carrier
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.label
Many thanks
Syed
Hi there
I have tried this on my side and it is working perfectly as I have suggested above.one thing
When we preview a report, the data for the report is cached to a file on the local computer. When we preview the same report report Designer retrieves the cached copy rather than rerunning the query. The data file is saved as <reportname>.rdl.data
in the same directory as the report definition file. In normal situation, the cached file doesnt work once we modify the query. I still suggest that you delete the cached .rdl.data file and then check the issue again.
Are you using Stored procedure or Dataset.
Please also try to filter the data in your dataset like this
Select *
from
yourtable
Where
Carrier in (@Carrier)
and take off the filter from Tablix and see if t ake any difference
Many thanks
Syed
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2012 5:11pm
Hi There
Thanks for your posting. Is your Value is exactly same as Fields!Carrier or your label is is exactly same as Fields!Carrier
Expression: =Fields!Carrier.Value
Operator: In
Value: =Parameters!Carrier.label
Many thanks
Syed
Yes, it was exactly as you outlined above. I checked the directory for an rdl.data file associated with this report and there isn't one... not sure why that is.
As for your second post, I'm not too sure what you mean. I have two stored procedures that this report uses: One that actually display the data, and one that generates the drop down list of carriers. Do you mean I should do that WHERE statement
in one of the stored procedures?
July 6th, 2012 3:40pm
Hi meef,
Thanks for your posting.
This is a known issue that passing multi-value parameter to a stored procedure. In SQL Server Reporting Services, multi-value parameters are passed to SQL stored procedures as a comma-delimited string of the values which cannot be parsed correctly by the
stored procedure. That way, only the first value of the parameter can be passed to the stored procedure. To work around the issue, we need to parse/split the comma-delimited string into values that can be used in IN clause or operator. For the details,
you can refer to the related thread and blog below:
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/0ead7ceb-3fdd-4625-aa82-1d4195f984b1/#f630f267-ae32-420b-a9ee-20fb79276f5dhttp://blog.summitcloud.com/2010/01/multivalue-parameters-with-stored-procedures-in-ssrs-sql/
Regards,
Mike Yin
Free Windows Admin Tool Kit Click here and download it now
July 10th, 2012 7:32am