Does Crystal Report support multiple database calls?

<N00b question, very N00by>

CR8, SQL2K Stored procedure, VB6 front-end that calls it.

Is it possible to perform Stored Procedure calls other than the main data source in Crystal Reports?

For example, I have a single parameter of broker_id that I pass to the report.  I'd like to have the report take that ID and make a separate SP call that returns the broker name, instead of passing it as another parameter or returning it as a field in my main data source.

Thanks in advance.
LVL 66
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

mlmccConnect With a Mentor Commented:
It depends on the version of Crystal.  CR9 and later can handle multiple data sources but I don't think in the way you are trying to do it.

You could do something like this

SELECT TableMain.*, TableDescript.brkr_description
FROM TableMain LEFT OUTER JOIN TableDescript  ON TableMain.brkr_id = TableDescript.brkr_id

The other way would be to use a subreport to get the TableDescript.brkr_description and link on the TableMain.brkr_id

gopatincConnect With a Mentor Commented:
I am not sure I fully understand what you are trying to accomplish here, but it is possible to have multiple stored procedures that are not linked. The result set will be a cross join between the two stored procedures
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
My main database call, which works for my entire report:

Each brkr_id (say 18) has a brkr_description (SomeCompanyName), which I would like to pass to my report and display in the most efficient manner.  

I could just add brkr_description to my table above, but I'm trying to avoid making the result set unnecessarily huge by grabbing 'SomeCompanyName' 1 to {number of records} times when I only really need to grab it once.  

An additional stored procedure can be used, which accepts brkr_id, and returns brkr_description.  My question is is this possible using CR?

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
'SomeCompanyName' will only be displayed in the report header as a title, and is not needed in the details of the report.
gopatincConnect With a Mentor Commented:
the subreport option looks like a better choice as the company name is a single value displayed in the Report header.
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
Thanks everybody.  The least painful way to pull this off was to create a subreport that only displays a broker name, based on a SP that receives the broker ID and returns the broker name, and use that subreport in my main report.   I linked the subreport to the main report by the broker ID parameters.

This should also be fairly reusable...

Thanks again.
Glad i could help

All Courses

From novice to tech pro — start learning today.