Search code examples
reporting-servicesreportingservices-2005

Reporting Services Cscading Parameter refresh


I have googled it a lot and found that usually it cannot be done. I came across one of the hacks here:

http://www.bp-msbi.com/2011/04/ssrs-cascading-parameters-refresh-solved/

But its not working for me in ssrs 2005. Just wondering if anyone else tried it in 2005. Or is there any other hacks that can be tried.

As per this article the dependent parameter gets refreshed only when its values are invalidated by the selection in the first parameter. If we can invalidate the dependent parameter every time a parameter changes we will enforce a complete refresh. An easy way to do this is to attach a value such as a GUID obtained with the NEWID() T-SQL function.

So basically we want to introduce a fake parameter in between two real parameters. This fake parameter is supposed to return new values everytime as the storedproc behind it will add a guid to the resultset everytime that proc is called. So it forces complete refresh of the other parameters.

Now the main issue I am facing is :

Setting the default value of this fake parameter. For the available values the storedproc behind the fake param runs and it returns data in the format say : result1,result2_GUIDFROMSQL

Now it looks like the same storedproc is called again to set the defult value if i ask it to get the default value from query. But as the storedproc is run again new guid comes and so the old value cannot be found so its not being set as desired.

I just need to figure out a mechanism to pass this guid from introduced param to the next param.

Thats where I am failing.

My issue can simply be replicated by creating a param whose datasource is this querystring.

select getdate() id, @name nid 

So in this case how to set a default value for this param.


Solution

  • Finally I was able to resolve this. This link was a helpful start. http://www.optimusbi.com/2012/07/16/multilevel-cascading-select/

    Basically what it does is : Writing parameter query in a manner so that the dependent parameter changes its value every time you change its parent parameter.

    The query adds rownumber with a "_" preceeding it. So every time user selects other values the rownumber changes and hence the query resultset.

    Then when using the resultset remove the text after the underscore to get the real codes.