Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Param based on another param

Status
Not open for further replies.

AyJayEL

Technical User
Jan 30, 2001
425
GB
Our users want to be able to run a report either by 'Officer' or 'Admin'. They will then choose the name from a list. So when they run the report the parameter prompts them to choose either Admin or Officer, if they choose Officer then it will only show Officer names and vice versa. These names are kept in different tables. ie Admin.Name or Officer.Name Learn something new every day *:->*
 
Hi Andy,

Why not just use two parameter pick lists, and let them choose which ever they want! The other can just be defaulted to "*".

Selection will just be ...
{Admin} like {?admin} and (Officer} like {?Officer)

Hth,
Geoff
 
Crystal reports doesn't support dynamic parameter selection. That is, you cannot base the pick list of one parameter upon the results of another pick list value. This can only be accomlished by using a custom front-end.
 
I got around this by creating 2 parameters and creating my own pick list for each of them. One called Officer and one called Admin. In the selection I did a formula that said:-

(if {?Officer or Admin} = "Officer" then {?Officer} = {Officer.FULLNAME} else {?Admin} = {Admin.FULLNAME})

It works. The end user ignores the parameter they are not using. If they chose officer they don't need to put anything into Admin. Neither did I need to use any sort of formula like if Officer = * then Officer etc. It just works, I don't know why.:cool:

I am using Crystal 8. Learn something new every day *:->*
 
Hi Andy,

It is the use of your THIRD parameter which is allowing you to do this!!

Just out of curiosity, does this actually drag the Admin and the Officer fields to the PC to calculate the formula,
even though only one is being tested?

If only one field is being used, then there may be some saving in network download size in using this approach.

Does there seem to be any improvement is performance between this approach, and my suggestion which is essentially the same but using just two parameters

Geoff
 
Geoff

re your question - Just out of curiosity, does this actually drag the Admin and the Officer fields to the PC to calculate the formula,even though only one is being tested?

If you mean do all the parameters show at the beginning when it is run? Then yes. And the names of officers and admin staff are in the lists under the parameters. The user Chooses either Admin or Officer. Whichever one they don't choose gets ignored.

If you mean something else then I am not sure. Perhaps you could explain to me how to see what it is doing.

It runs really quickly. Learn something new every day *:->*
 
Hi Andy,

Does the SQL expression passed to the server include the result of your parameter decisions, ie. select only the specified officer or admin name selected, or is that part of the selection done once all the relevent info is downloaded to the PC from the server.

For example, when in crystal it displays 7000 records selected but only 200 are actually for the selected officer.
Hence only 200 records are displayed in the report.

If only 200 are extracted, and 200 displayed then all the processing for the selection criteria is being done on the server as apposed to the PC.

Geoff

 
If I have another selection on it would this make a difference? ie a date range? If not then the PC is doing all the work (I have more records processed than displayed). Learn something new every day *:->*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top