mattruma
mattruma

Reputation: 16677

Pass parameters to a stored procedure in a Crystal Report sub report?

I have a Crystal Report, that is populated with a stored procedure, it also contains a sub report, that I am trying to populate with another stored procedure ... same parameters. I cannot figure out how to pass the parameter value to the sub report.

Any help would be appreciated!

Upvotes: 1

Views: 34753

Answers (4)

James Murgolo
James Murgolo

Reputation: 106

I understand this question is old but I didn't find any satisfactory answers to this. The simple solution I found is to implement the stored procedure from within a crystal command just like any other command sql. I could not get the parameters to show up in the bottom left drop downs no matter what. Something similar to below where ZNG_PROACTIVE_STREET_SWEEPS is the name of the stored procedure and the two parameters are what the stored procedure takes in.

[dbo].[ZNG_PROACTIVE_STREET_SWEEPS] @StartDate ={?begindate}, @EndDate = {?enddate}

Upvotes: 2

Bhavish
Bhavish

Reputation: 11

You can pass value to sub report like this:

oRpt.SetParameterValue("@InvNo", Session("InvoiceNo"), "rptInvoicePrintSub") ' parameter for subreport

Upvotes: 1

wouter
wouter

Reputation:

Sounds all so simple, but unfortuanate it isn't that simple. I can link the parameters from main to sub -report, no problem. But when it comes to feeding it to the subreport procedure parameters it becomes rather difficult.

I'm using Crystal XI. Same procedure main and subreport. The aim is to let the user select the parameters only once. Currently, the user needs to select the parameters for both main and sub report.

Ok, I over-read the comment where to find the dropdown. The drop down is in the screen subreport links. On the botton there are 2 dropdowns, use the one on the left.

Upvotes: 0

DJ.
DJ.

Reputation: 16247

When you add the stored proc to the sub-report CR will add the parameters automatically. Then when you set up the sub-report links you link the main report parameters to the sub-report parameters.

Upvotes: 2

Related Questions