Link to home
Start Free TrialLog in
Avatar of Michael Graham
Michael GrahamFlag for United States of America

asked on

Multiple Parameters in Crystal

Hello,

 I have a field in which my boss wants two separate parameter prompts on the same field (I have always used a range parameter).

 The two prompts would be 1.) |enter first number| and 2.) |enter last number|

 The field is just a number (it can only be 2 through 5).  

 If |enter first number| = 2 then |enter last number| would give a choice of 2, 3, 4, or 5.  If they enter 5  for|enter last number|then you would get values 2, 3, 4, and 5 in the report.  If they enter 3 for |enter last number| then they would get values 2 and 3 in the report.

 However, if |enter first number| = 3 then |enter last number| could be 3-5

 If |enter first number| = 4 then |enter last number| could be 4-5

 If |enter first number| = 5 then |enter last number| could only be 5

 I'd also like a dropdown option and an ALL in the dropdown for both parameters which would just return all results.
Avatar of Ido Millet
Ido Millet
Flag of United States of America image

For the 2nd parameter adjusting itself, afaik, this can't be done with Crystal alone.
But you can add logic to the report so that if the user selects 2nd value that is less than the first one, the report would display no records and a text box would be unsuppressed to show a message telling the user that the 2nd parameter cannot be a value lower than the first.

For the 'ALL' option, you can set the parameter data type to String and use logic such as:
...
AND (
{?2nd_Parameter} = "ALL" or {Some_column} <= cDbl({?2nd_Parameter})
)
Avatar of Michael Graham

ASKER

Okay thank you very much.  

So if they entered "2" on the first parameter and entered "4" on the second parameter there would be no way of display 2-4?

I understand the problem of using a lower digit (and they should understand that).  I.E. 3 for the first and 2 for the second.
I guess whenever I enter 2 for the first parameter no matter what I put in the second parameter it will only give me 2
> So if they entered "2" on the first parameter and entered "4" on the second parameter there would be no way of display 2-4?

Simply use a record selection condition of col >= 1st parameter and col <= 2nd parameter.
okay I tried this and it didn't work:

col >= {?@drugschedulestart} and col <= {?@drugscheduleend}
I am doing this record selection formula editor
Use your column not my "col" example.
okay sorry about that now I am getting this error: this array (the parameter in my report) needs to be subscripted (for example array)
ASKER CERTIFIED SOLUTION
Avatar of Ido Millet
Ido Millet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome! That worked.  Thank you so much.

Mike
I am new to Crystal Reports so I had to be walked through it a bit but Ido helped me despite myself