Page 1 of 1

Passing parameters from one sp to another

PostPosted: Tue May 28, 2019 12:28 pm
by Atronics
I have a simple report which is driven by a sp to deliver average invoice values. The report has a sub-report to deliver credit note values. I am unable to get the sp parameters which are used in the main report to pass to the sub report which uses a similar sp. The report and sp's are attached.

Re: Passing parameters from one sp to another

PostPosted: Tue May 28, 2019 12:55 pm
by Scott.Pearce
Here is what I did. I *think* it's working OK but have not tested thoroughly.

1. Right-click on subreport and choose "Change subreport links..."
2. Remove all fields in the right hand pane.
3. Add the following fields to the right hand pane:

@sp_DateFirst
@sp_DateLast
@sp_ClassificationFirst
@sp_ClassificationLast
@sp_AccountNoFirst
@sp_AccountNoLast

NOTE: These are the crystal generated parameter fields, NOT the formulae you created that are prefixed with "PASS_"!

Now change the "Subreport parameter field to use:" value for each field to link to thus:

@sp_DateFirst - ?@sp_DateFirst
@sp_DateLast- ?@sp_DateLast
@sp_ClassificationFirst - ?@sp_ClassificationFirst
@sp_ClassificationLast - ?@sp_ClassificationLast
@sp_AccountNoFirst - ?@sp_AccountNoFirst
@sp_AccountNoLast - ?@sp_AccountNoLast

I've attached the modified report, and have also attached fixed sql scripts, as they were failing when there was no data being returned (The insert in the stored proc for when there is no data was erroring with "Column name or number of supplied values does not match table definition")

Re: Passing parameters from one sp to another  Topic is solved

PostPosted: Tue May 28, 2019 1:19 pm
by Atronics
Hi Scott,
Thank you for your recommendations and rapid response. Much appreciated.
John I.