Crystal Reports 11 command parameters

Posted on 2011-02-16
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 101

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 2000 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 35

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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