Crystal Reports 11 command parameters

Posted on 2011-02-16
Last Modified: 2012-08-13
How do Crystal Reports 11 commands work exactly? Commands look like database tables during a report setup. Are these command/tables recreated in their entirety each time a report table link points to a command?

Within Crystal Reports 11, is it possible to automatically and variably populate a command parameter from the main report?
Question by:BuddyTo
LVL 100

Expert Comment

ID: 34909948
Commands are like a database stored procedure.

The command is run each time the report is opened just as a stored procedure is or a view is run.

Not sure what you are getting at with
--   is it possible to automatically and variably populate a command parameter from the main report?

LVL 26

Accepted Solution

Kurt Reinhardt earned 500 total points
ID: 34911132
1)  A command is conceptually the same as a stored procedure - it must be executed 100% before most other Crystal Reports functionality.  That's not really the same as a view, which is simply treated by Crystal like any other table (it's simply materialized at runtime). Generally speaking, if you're using a command as a data source for your report then it should be the only data source.

2)  A command parameter needs to be created inside the command explicitly as opposed to normal Crystal Reports parameters that are created in the Field Explorer.  Once you've created the command and it's parameters, you can edit the parameter in the field explorer and append a list of values to it.  Those values, however, will be static. You can't make them dynamic, which is what it sounds like you're asking for.

Is there a specific reason you're using a command where regular tables or a view won't work?


Author Closing Comment

ID: 35031134
Thank you for your answer.
I am using commands because my connection to the target database is restricted to Crystal only. No SQL views, stored procedures, other languages, etc, are allowed.
If commands allowed "dynamic" parameter passing, then a command could act like a sub report AND could be placed on a sub report... a sub report on a sub report. This would help solve some fairly complex report problems I have involving nested bills of materials and my need for recursive reports.
LVL 34

Expert Comment

ID: 35042965
 > If commands allowed "dynamic" parameter passing, then a
 > command could act like a sub report AND could be placed
 > on a sub report... a sub report on a sub report.

 I'm not sure what you're suggesting.  A Command parameter can be "dynamic" in that it can be passed different values.  For example, you could have a subreport that uses a Command that has a "part code" parameter and reads data for that part code, and a main report that reads a list of part codes.  The main report executes the subreport for each part code, and passes the part code to the parameter in the subreport, which uses that part code in the Command.

 But a Command is a datasource.  It's not "placed on" a report.  So I don't know what you were getting at there.

 Also, FWIW, a dynamic parameter in CR is one that gets the list of default values from a query, but someone/something still has to choose values from that list.  So, that kind of dynamic parameter doesn't really seem relevant/useful here.


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now