• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

Pass value to stored procedure without using a parameter prompt

Crystal Reports 2016

Is it possible to pass a value to be used in a stored procedure from crystal that does not use a parameter prompt?  I ask becuse I wish to use the same sp for various values and wish to hardcode that value in each subreport.

If the stored procedure uses:


Sub report 1

@AgencyType = 'PD'

Subreport 2

@AgencyType = 'FD'


The stored procedure is called with

execute CR_UCR_Code_IncidentCntwithPercetageByAgencyType {?Year}, {?AgencyType}

I need to pass the year since this is the date range the report will be run against.
But I don't want individual prompts for each sub report.  I just want that value  'PD' or 'FD' to be hardcoded into each corresponding subreport.
1 Solution
Kyle AbrahamsSenior .Net DeveloperCommented:
You can link the subreport parameter value to a forumla.  Also if that's dynamic (Eg: in your result set) you should be able to link the subreport to the value of the field.


Create a formula for each parameter you do not want to be prompted by.  If you have a parameter that prompted for a Country then you need to add a country value in the formula.

The formula will look like:


So the value passed to the parameter will be USA.

4. Insert you report as a subreport in the Report Footer section.

5. Link the subreport parameters to the formula you just created.

5.1 To link the formula to a parameter, right click on the subreport and in the contextual menu, select "Change Subreport Link"

5.2 In the "Change Subreport Link" window, under the list of available fields in the upper right corner, locate your formula, then add it to the "Fields to Link to" list.

5.3 In the bottom left corner, go in the drop-down list of "Subreport parameter field to use" , and select your subreport parameter.

Repeat the above steps for each parameter you do not want to be prompted by, then click "OK" to accept the changes.

Now when viewing the report, you will not be prompted by your parameter as a default value as been assigned to it.
You can use a command and in the command to use a Year parameter and hardcoded value for the other parameter
MikeM670Author Commented:
That seems to have done the trick!  Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now