Skip to Content
avatar image
Former Member

Sub Report Parameters

Here is a simplified example of what I am trying to do... I simply want to be able to set a parameter in a

sub report (the sub report was dynamically added using RAS) to some value... this example does not work.

Can anyone correct the syntax in this example so it works:

Dim objParameterFieldDefinitions As CrystalDecisions.ReportAppServer.DataDefModel.Fields
Dim objParameterFieldDefinition As CrystalDecisions.ReportAppServer.DataDefModel.ParameterField
Dim objNewParameterFieldDefinition As CrystalDecisions.ReportAppServer.DataDefModel.ParameterField
objParameterFieldDefinitions = boSubreportClientDocument.DataDefController.DataDefinition.ParameterFields

Dim strValue as string = "Hello"

For Each objParameterFieldDefinition In objParameterFieldDefinitions
     If objParameterFieldDefinition.Name = "Test" Then
        objNewParameterFieldDefinition = objParameterFieldDefinition.Clone(True)
        Dim objParameterDescreteValue As New _

        objParameterDescreteValue = objParameterFieldDefinition.Values
        objParameterDescreteValue.Value = strValue   'THIS IS NOT VALID...  NOT SURE HOW TO SET THE VALUE

        objParameterValues = objNewParameterFieldDefinition.Values
        boSubreportClientDocument.DataDefController.ParameterFieldController.Modify( _
        objParameterFieldDefinition, objNewParameterFieldDefinition)
    End If



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 02, 2008 at 07:09 PM

    I would suggest to set the parameter from the main report like this:

    boMainreportClientDocument.DataDefController.ParameterFieldController.SetCurrentValue(boSubreportClientDocument.Name, strName, strValue)

    Typically the way the parameters used to work with the other .NET SDK was that all parameters in the report including the subreport were concidered to be owned by the main report and set through the main report object. In my scenerio the above worked.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Trevor!

      You were correct - I put together a smaller sample and this worked great. I just need to figure out what I am doing wrong in my main application.