Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

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

$
0
0

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)


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>