Dynamic Parameter-Defaultvalues not working when using custom assemblys

  • Hi Everyone,

    My Reports are using Assemblies, for translation and for some Navigation-tasks.

    I’ve declared them in ‘References’ and create instances of them via Code. For that I’m using a Parameter @Languagecode to set the Target-Language. That all works perfectly, and here is my Code for that:

    Public Translation As Resources.ResourceProvider
    Protected Overrides Sub OnInit()
    Translation = New Resources.ResourceProvider(Report.Parameters!PHT_Languagecode.Value.ToString())
    End Sub

    And now the Issue. If I add a dynamic Default-Value on any Parameter, I got an error that my Parameters are not defined in that Report. It doesn’t matter if I’m just add a formular as default value ore try to get it from a Query, as soon as my Value is not static, I get this error.

    To make it even more confusing (to me) its not just the Parameter I’m using in my Code, its every Parameter existing in the Report. For Example:

    @Parameter1 <- static default value
    @Parameter2 <- static default value
    @Parameter3 <- dynamic default value
    @Parameter4 <- static default value

    The Error says “@Parameter1 is not defined in the Report”. If I’m deleting it ore change the default to any static content, it’s the same then with “@Parameter2” and so on.

    I already figured out that the problem comes from the “Protected Overrides” call, but if I don’t run it with protected override, my instancing is not working.

    Does anybody have a Idea of what is going on and – quite more important – how to solve that?

    Many thanks in advanced,

    Mirko

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Hi Guys,

    I found something interesting for the situation on Micrososft.com

    https://docs.microsoft.com/en-us/sql/reporting-services/custom-assemblies/initializing-custom-assembly-objects?view=sql-server-ver15

    It says "[...]  The Parameters, Fields and ReportItems collections are not available to you at the point in the report lifecycle when the OnInit method is invoked. [...]"

    the only Problem is: that is not true, its only true if I try to use non-static Default-Parametervalue.

    I try again - did anybody may faced that problem before? Or something related?

    Thanks a lot guys, i'm getting desperated...

    Many thanks in advanced,

    Mirko

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply