Solved

Multiple Parameters in Crystal

Posted on 2016-09-20
11
78 Views
Last Modified: 2016-09-20
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.
0
Comment
Question by:Michael Graham
  • 7
  • 4
11 Comments
 
LVL 22

Expert Comment

by:Ido Millet
ID: 41807777
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})
)
0
 

Author Comment

by:Michael Graham
ID: 41807787
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.
0
 

Author Comment

by:Michael Graham
ID: 41807788
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
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 22

Expert Comment

by:Ido Millet
ID: 41807789
> 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.
0
 

Author Comment

by:Michael Graham
ID: 41807795
okay I tried this and it didn't work:

col >= {?@drugschedulestart} and col <= {?@drugscheduleend}
0
 

Author Comment

by:Michael Graham
ID: 41807802
I am doing this record selection formula editor
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 41807803
Use your column not my "col" example.
0
 

Author Comment

by:Michael Graham
ID: 41807809
okay sorry about that now I am getting this error: this array (the parameter in my report) needs to be subscripted (for example array)
0
 
LVL 22

Accepted Solution

by:
Ido Millet earned 500 total points
ID: 41807812
Don't set the parameter to allow multiple values.
0
 

Author Comment

by:Michael Graham
ID: 41807820
Awesome! That worked.  Thank you so much.

Mike
0
 

Author Closing Comment

by:Michael Graham
ID: 41807821
I am new to Crystal Reports so I had to be walked through it a bit but Ido helped me despite myself
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question