Home Dashboard Directory Help
Search

Report Parameters collection is not populated in OnInit event when report has query dependent parameters. by MunLeeuw


Status: 

Closed
 as By Design Help for as By Design


0
0
Sign in
to vote
Type: Bug
ID: 383212
Opened: 11/20/2008 1:44:43 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

I use the report OnInit event to set custom assembly properties with parameter values. If the report also contains parameters that are query based, then the parameters collection is empty when the OnInit event fires. A report with the following attributes ran without warning in SQL RS 2005. The parameters that I set are language and theme, these parameters are completely unrelated to the parameter that is populated with availible values from a query. I applied SQL Cummulative update 1, but have not applied update 2, just downloaded it and will give that a try. I did not find this issue in the KB's listed.
Details
Sign in to post a comment.
Posted by Microsoft on 1/15/2009 at 2:25 PM
Hello,

Thanks for reporting this issue. After reviewing the code, specs, and documentation, we have resolved this issue as By Design. Per both the RDL spec and Books Online documentation, the Parameters collection may not be referenced from the OnInit method during parameter initialization (see links below). This restriction wasn't strictly enforced in RS 2005 so parameters which did not use expressions or data sets and appeared first in the list of Report Parameters could be referenced. This behavior was inconsistent and would be extremely difficult to replicate in the RS 2008 engine.

Unfortunately, RS doesn't currently provide a way of detecting whether OnInit is called for parameter initialization or for body initialization. However, we can suggest a workaround that should allow your report to work in RS 2008. Try modifying your OnInit code along the following pattern:

Protected Overrides Sub OnInit()
     Dim temp As String
     Try
         temp = Report.Parameters!independentParam.Value
     Catch ex As Exception
     End Try

     Dim myParam as String
     If(temp <> Nothing)
            myParam = temp
     End If
End Sub

We are considering changes for a future release which would make it easier to distinguish between parameter initialization and body initialization. However, we don't have definite plans at this point.

Documentation Pointers Regarding OnInit Behavior:
-    Please see "Restrictions on Use of Global Collections" on page 100 of http://download.microsoft.com/download/c/2/0/c2091a26-d7bf-4464-8535-dbc31fb45d3c/rdlNov05.pdf. In particular, please see footnote 34.
-    Additionally, please see the "Initializing Custom Assembly Objects" topic in the Books Online documentation (http://msdn.microsoft.com/en-us/library/ms152801(SQL.90).aspx)

Thanks,
John
SQL Reporting Services Team
Posted by MunLeeuw on 12/23/2008 at 7:20 AM
I have applied update 2 and I can still reproduce this issue.
Thanks,
Steve MunLeeuw
Posted by Microsoft on 12/22/2008 at 3:10 PM
Hello,

thank you for reporting this problem. We apologize for the delay in the initial response, which happened due to a miscategorization of this issue in our tracking system. We will investigate if a workaround for this issue is possible and get back to you.

Thanks,
Robert
Reporting Services Team
Posted by Microsoft on 12/12/2008 at 11:46 AM
Thank you for posting this issue. Your post should be reviewed the appropriate product team soon.
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
ParameterOnInitProblem.rdl (restricted) 11/20/2008 -