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!

Parameter in Crystal Reports 8 1

Status
Not open for further replies.

Tech2377

Programmer
Nov 13, 2007
81
I have a parameter that is not working. My report pulls patients based on their doctor. I want to give the report users the flexiblity to report any patient using _ALL. Patients that have a doctor at EastsideClinic and also be able to pick specific doctors to get a patient list. The parameter works fine until I added that _EastsideClinic piece. I keep getting a missing ")" error.

("_ALL" in {?Doctor} OR "_EastsideClinic" in {?Doctor} = {doctor.last_name} in ["Thomas", "Edward"] OR {doctor.last_name} = {?Doctor})
I also tried "_EastsideClinic" = {doctor.last_name} in ["Thomas", "Edward"] in {?Doctor}
 
Please try to explain again what you are trying to do. It is unclear how you the EastSide clinic is supposed to fit in.

-LB
 
I think you've used '=' where you mean 'OR'. Try
Code:
("_ALL" in {?Doctor} 
OR "_EastsideClinic" in {?Doctor} 
[b]OR[/b] {doctor.last_name} in ["Thomas", "Edward"]  
OR {doctor.last_name} = {?Doctor})
It can be easier to write as a formula, a 'boolian' since it has no IF ... THEN. Such formulas return True or False and you can put them beside the unselected data, fine-tune them before use. Once it is right, just place the name in record selection to get the selection.

PS. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
The parameter is based on doctors table > doctor mnemonic. The report shows patients grouped by the doctors mnemonic. The doctors are located in multiple locations including hospital, Eastside Clinic and the Westside Clnic. There is no place in the database that shows where the doctor is located. I can not change that so I need to find a work around.

When the user runs the report the parameter will give three options.

1. Select _ALL and this will populate the report with all patients associated with ALL doctors.
2. Select an individual doctor and get a list of their patients- the parameter is populated from the doctor table so all doctors appear in the list.
3. I want the user to be able to select Eastside Clinic if needed. I will write the coding behind with a list of doctors that are located at that clinic- my example shows Dr. Thomas and Dr. Edwards.

As I stated - the _ALL and individual works fine. When I add the Eastside Clinic coding, I get errors related to missing ")". However, I do not see a reason for the error. I must have something wrong with the way I have it coded or maybe what I want to do cannot be done.

I am writing the code under Record Selection Formula Editor.
 
Madawc

OR "_EastsideClinic" in {?Doctor}
OR {doctor.last_name} in ["Thomas", "Edward"]

The problem with this is that Eastside Clinic is not associated with Thomas and Edward.. Your coding says that if the users picks Eastside Clnic then populate the report with all the doctors. The same way _ALL is working.
 
Why not have multiple paramaters and call them if the 1st parameter is set to a particular clinic?

{?Clinic} parameter to select clinic from list of possibles
{?eastside} parameter to show list of available doctors for eastside clinic
{?westside} parameter to show list of westside doctors.

in your selection criteria you can then select based on parameter population as follows

//select parameter based on 1st parm selection

if {?Clinic} like 'Eastside' then {table.docname} = {?eastside} else
if {?clinic} like 'Westside' then {table.docname} = {?westside} else
{table.docname) > ''

Would list all docs if neither west or east selected. If you wanted to then further delimit it to show all obviously it would be dependant upon structure of your datasource to allow for an all condition as appropriate.

'J
 
CR85User:

I tried it. Eastside Clinic shows up as a separate selection parameter when I run the report along with Clinic. The report runs but only Thomas shows up because he is the first doctor in the list for the Eastside Clinic parameter. I would only want the Clinic parameter to show up for the user if I went with your suggestions. I also want to be able to select individual doctors regardless of their clinic association.

My user will not want a bunch of different selection parameters. She wants one where she can pick ALL, Eastside Clinic or an individual doctor.
 
Ahh I see now.

If you are happy to use a static parameter then you should be able also to program that accordingly.

Create a parameter to allow selection:

{?Param}
//Choices as follows:
All
Eastside
Doctor 1 name
Doctor 2 name
etc

Then in your selection criteria match based on the selected option from the parameter list:

If {?param} like 'All' then {doctor.last_name} > '' else
If {?param} like 'Eastside' then {doctor.last_name} in [name1,name2,name3,etc] else
{doctor.last_name} = {?param}

Does that make sense in the way I have explained it? Obviously it would need a large amount of manual work to set it up and maintain it if there are regular changes to which doctor is where, but it does give you the selection you requested.

'J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top