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

Picking records in the drop down list in parameters

Status
Not open for further replies.

tweetyng

MIS
Feb 23, 2006
46
US
Hi, please help
I’m using crystal report 10, database type: OLE DB(ADO) with SQLOLEDB server.

I’m trying to run the parameters.

The 1st parameter has three STATIC values : “Case Number”, “Patient Number” and “Case Name” in default values.

If I pick "Case Number" in the 1st parameter, then the Dynamic Parameter in the 2nd drop-down that would appear all records in the table such as:

15
22
23
48

Sample data is below....

RECORD CaseNo PatientNo CaseName
1 15 82545 Johnson
2 22 82582 Travis
3 23 95221 McNail
4 48 97215 Lagunas


Code below:

Named {?Type} for 1st parameter and {?Type_Selection} for 2nd parameter.

In the record selection formula, I use:

If {?Type} = "Case Number" then
{table.CaseNo} = {?Type_Selection} else
if {?Type} = "Patient Number" then
{table.PatientNo} = {?Type_Selection} else
if {?Type} = "Case Name" then
{table.CaseName} = {?Type_Selection}

In main report I named fomula {?Fields}and code:

if {?Type} = "Case Number" then {table.CaseNo} else
if {?Type} = "Patient Number" then {table.PatientNo} else
if {?Type} = "Case Name" then {table.CaseName}

I don’t know what to do for the 2nd parameter? Please help.


TN (USA). I'm using Windows XP, Crystal Reports 10 and SQL Server
 
You can't pass a fieldname to a dynamic parameter, but how about if you try something like running the report with a a group option.

if {?Type} = "Case Number" then {table.CaseNo} else
if {?Type} = "Patient Number" then {table.PatientNo} else
if {?Type} = "Case Name" then {table.CaseName}

add a group based off the {?Type} formula field.

Thanks so much!
satinsilhouette
 
Thanks for the reply satinsilhouette, but it's not the data so I can't do about the grouping.
I mean in each field, like CaseNo, or either PatientNo, there are many values in each. So I would like the user to choose either run by their choice. If they choose run the report by PatientNo, then it will list all the PatientNo in the dynamic drop down for them, so then they have to pick one patient in that list to run the report.
So if anyone have any ideas, please help.
I'm very appreciated.
thanks.

TN (USA). I'm using Windows XP, Crystal Reports 10 and SQL Server
 
I don't think there's a way to create a dynamic parameter based on text. You could set this up with static parameters by setting up separate lists of values for each of your secondary parameters, and then using a record selection formula like:

(
select {?type}
case "Case Number" : {table.CaseNo} = {?CaseNo}
case "Patient Number" : {table.PatientNo} = {?PatientNo}
case "Case Name" : {table.CaseName} = {?CaseName}
)

For the secondary parameters, add a default value "None" or 0 (depending upon the datatype) and then in the prompt text say something like:

if "Type" (above) = "Case Number}, then select a Case Number from the dropdown; otherwise select "None".

This makes it more intuitive for the user.

-LB
 
Thanks lbass
I tried but seem it's not working.
When I run the report, it opens the 1st parameter to select. Instant when I selected "Case Number" then it won't open the second parameter to choose the values in the drop down list. So what am I missing?
please help

TN (USA). I'm using Windows XP, Crystal Reports 10 and SQL Server
 
I use CaseNo and PatientNo with value type: number and CaseName is string

TN (USA). I'm using Windows XP, Crystal Reports 10 and SQL Server
 
They should all be set up as static parameters.

-LB
 
With crystal 10 you do not have a dynamic parameter option do you?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"A fine is a tax for doing wrong. A tax is a fine for doing well.
" - unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top