Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Command parameter dynamic multiple Post Reply Post New Topic
Author Message
Nissim
Newbie
Newbie


Joined: 04 May 2010
Online Status: Offline
Posts: 18
Quote Nissim Replybullet Topic: Command parameter dynamic multiple
     Posted: 27 Jun 2010 at 5:04am
Hello,
I create a simple command like "select * from employee where employeeID in {?empID}
then I create a command parameter within the Modify Command window and I define it as a number datatype and I check the allow multiple values.
this is working fine.
Now I want to dynamically retrieve the values of this parameter from the database. So I modify the parameter in the field explorer. I set the parameter List of values to Dynamic and I choose the fields from the database fields: empID and empName as the description.
Now when I refresh the report I get the parameter screen twice. why is that? how can I make it popup the parameters screen only once?

I'm using CR 2008 SP2
Please help.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Jun 2010 at 3:17am
you are using the parameter twice, once for retrieving the employee and once when getting info about the employee...so CR asks for the info twice.  Why not use the Dynamic parameter to join to the employee table, that's what you're doing already...doesn't make sense for the simple command...unless you have other ideas for the command objects.
 
HTH
IP IP Logged
Nissim
Newbie
Newbie


Joined: 04 May 2010
Online Status: Offline
Posts: 18
Quote Nissim Replybullet Posted: 28 Jun 2010 at 4:14am
This is not precise. I defined the parameter within the command and then I'm editing it in the field explorer. I change it to dynamic instead of static.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 28 Jun 2010 at 4:37am
a Command is not a Parameter...it is a datatable that supports Parameter/Report (though I believe it is designed to only support Parameters).  When you reference the parameter as something that the command needs to look at, CR asks for the value. 
 
Static means it doesn't change, so asking once is sufficient.  As soon as you make it Dynamic, it needs to go and select the values based on some criteria, and needs to ask again. 
 
What I don't understand is the why.  Where are you getting the EmployeeID...wouldn't it be from the employee table?  If so, why the command.  It just seems that you are doing more work than you need to.
 
I'll be honest, I am not that knowledgable on parameters and commands.  I have used them, but I use commands to populate lists for the user to select from.  I never use a parameter as part of a command...I want the list, not a filter.  If I was to do that, I would use the command to get a list, then I would have the user select from the list, and if I needed to filter the data, I would put the filter criteria in the Report/Selection Formulas/Record.
 
IP IP Logged
Nissim
Newbie
Newbie


Joined: 04 May 2010
Online Status: Offline
Posts: 18
Quote Nissim Replybullet Posted: 28 Jun 2010 at 8:19am
The main different put the selection criteria i the SQL command (as where clause) and put in as a selection formula is performance.
when you do this in the selection formula the criteria dose not combine in the SQL. Instead it retrieve all the data from the database and then filter the data within the report. Now what will happen if you put a command like "select * from employee" and then put a selection formula emp_id = 10. It will retrieve all the Million employees and the filter it to employee number 10.
the other way to do this is to use the command with a parameter - "select * from employee where emp_id = {?param}" in the command window you can create a parameter that will show up automatically in the field explorer later.
In this case the report will retrieve only the selected employee from the database and not all the employee table.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 29 Jun 2010 at 3:48am
I understand the difference, but what you are doing makes no sense...why not just join to the employee table in the report, and then it will only select only the employee that you want...why bother with the command.  After all, if you know the userid, you probably want them on the report, so using the employee attribute to narrow the selection seems inane.
 
If you are using the command object to populate the data for your report, then I would suggest that you are using the command object incorrectly... I don't believe that is was designed/intended to power the report, that is what the various data connectors are for. I believe, and no one has said to the contrary, the the command object was designed to assist in creating dynamic lists for the parameter inputs.
 
ok, so how do you stop it from displaying twice?


Edited by lockwelle - 29 Jun 2010 at 4:22am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum