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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select from Multiple Parameters 1

Status
Not open for further replies.

HiHeidi

Technical User
Aug 16, 2001
15
US
Users of my report want to from either Record.name or Record.Id. How do I build a prompt that
1) asks if they want Name or Number then

2) prompts them to enter the value for that parameter.

Help!

Heidi
 
You could use a single prompt (e.g., Please enter
Account Name or ID) and by checking the type of data
using the IsNumeric() function, you can then branch
your selection logic.

Alternatively, you can use two prompts and branch the seelction logic accordingly.

Cheers,
- Ido
ixm7@psu.edu
 
More detail... How do I build a branch?

Eek!

Heidi
 
In your Record Selection Formula have something like:

IF IsNumeric({?myprompt}) then
{Account.ID}= ToNumber({?myprompt})
else
{Account.Name}={?myprompt}

Cheers,
- Ido ixm7@psu.edu
 
Crystal does not support dynamic parameters in the sense that you can select one parameter value from a list that is based on the value of a previously selected parameter.

Example - you can't do this:

Parameter 1 = Select Name or ID
Parmaeter 2 = Either a list of names or a list of IDs depending on the value selected for Parameter 1

Instead you'll end up building 3 parameters:

Parameter 1 = Select Name or ID
Parameter 2 = Record Name
Parameter 3 = Record ID

Next, your record selection statement would use conditional If-Then-Else statements:

If
{?Parameter 1} = 'Name'
Then
{record.name} = {?Parameter 2} Else
If
{?Parameter 1} = 'ID'
Then
{record.id} = {?Parameter 2}

The downside to this is that your If-Then-Else criteria won't be processed server side; it'll be processed client-side. Performance will always be slower client-side, however, the impact depends on a variety of factors such as the number of records returned based on other selection criteria, database size, indexes, etc... If the performance is livable then this is an ok option. If performance is horrible then you may want to consider splitting this into two reports or basing the report off a stored procedure.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top