cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a parameter from Main to Sub to use in a Formula

Former Member
0 Kudos

I'm trying to parametrize what is essentially a query in a sub-report from the main report.

I need to pass a string "%Drug%" from the main report.

I've created parameters in the main and sub reports and the formula in the sub-report which is "{field} like {parameter}".

The code in VB is:

        Dim paramV = New CrystalDecisions.Shared.ParameterDiscreteValue
        paramV.Value = "%Drug%"
        UCRpt.ParameterFields(1).CurrentValues.Add(paramV)
        UCRpt.SetParameterValue(0, paramV, "Subreport4")

Where the last line is (from what I've read) supposed to populate my sub-report parameter.

I've also tried using the customize link to get the value from main to sub.

The error I got before adding the last line was "Missing parameter". After adding the last line I get an error on the code that the index is bad.

According to what I can glean the last line is referencing parameter (0) in the named sub-report.

(Attached images of parameters and linkages)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I gave up on this and decided to use a filtered dataset, which is actually working, sort of. I've got the data I want visible in the xml dump, but now I'm getting prompted to log into the database. The dataset object is identical to the dataset xsd, so I'm not sure what it's unhappy about.

Answers (0)