Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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



Former Member
Former Member replied

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.


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question