Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

Crystal Reports 11 Multiple Parameters on same field

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.

If this is possible at all I would really appreciate the help.  I'm pretty new to this but I bet this would be pretty tricky.

Thank you,

Mike
0
Michael Graham
Asked:
Michael Graham
  • 4
  • 3
  • 2
2 Solutions
 
mlmccCommented:
I don't believe what you want can be done in Crystal.  You could do it in your own application and parameter page.

mlmcc
0
 
James0628Commented:
It may not matter, but, just in case, are you talking about CR XI or CR 2011?

 Is it really necessary to have the choices for the second parameter be based on the value selected for the first parameter?  If they make bad selections (eg. 5 and 2), they just won't get any data.  If you wanted, you could put a message on the report that appears when the selected range is invalid.

 If you really want to limit the second parameter, I was thinking that you might be able to use cascading parameters to base the values in the second parameter on the values in the first one, but I haven't used cascading parameters, so I don't know if that will actually work.

 If the parameters are numeric, you can't have an "All" value, but you could use something like 0 to designate "all".  FWIW, if you selected 0 for the first parameter, you would still have to select a value for the second parameter, unless you made the second parameter optional (if your version of CR supports that feature).

 If you made the parameters string, you could have an "All" value, but then you'd have to convert the strings to numbers to compare with your field.  Converting the values is not a problem, especially if the parameters are limited to specific values ("2", "3", "4", "5" or "All"), as long as the conversion step doesn't prevent the test on your field from being sent to the server (so that it can filter the records for you).  FWIW, if the second parameter is a string and has a default value, then the user won't be required to select a value for that parameter (that seems to apply to string parameters, but not numbers).  IOW, if they select "All" for the first parameter, they can skip the second one.

 James
0
 
Michael GrahamData AnalystAuthor Commented:
Hi James,

Thanks for the response.  I am using Crystal Reports 11.  

I still have a lot of work to do on this report (and this is basically my first report).

1.) I need to format an 11 digit field that looks like this presently: 11111111111.  I need to make it look like 11111-1111-11

2.) The parameters I am using worked for what I was trying to accomplish above (for example if they enter 4 for the first parameter and they enter 2 for the second parameter the report is blank which is what I want).

3.) I am trying to figure out how if they leave a parameter field blank it will just return all records.

4.) In my Report Header I used imported an OLE Object (PDF) and my boss was wondering if there was some way to do this natively in Crystal to make it look better.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
James0628Commented:
FWIW, I saw your other question about this after I posted my reply.

 For #3, it depends on what you mean by "leave a parameter field blank".  If it's a string field, you can have the empty string as the default value and you'll get that if you skip that parameter.  If it's a numeric parameter, I think you'll have to select a value, unless the parameter is optional.

 If you can decide on an "all" value for the parameters, it's easy enough to check for that value in the record selection.  For example, if you have 2 numeric parameters and want to get all records when either of them is 0, you could use something like:

{?param1} = 0 or {?param2} = 0 or
({your field} >= {?param1} and {your field} <= {?param2})

 You should start new questions for the other questions, since they're unrelated.

 James
0
 
Michael GrahamData AnalystAuthor Commented:
Thanks James,

It is a numeric parameter.  I tried to put the parameter as optional but it is still forcing me to input a value.
0
 
James0628Commented:
I haven't actually used optional parameters, so I don't know why that would happen.  FWIW, if you can get that to work, then you'll need to use HasValue to know when a value was not entered for the parameter.

 James
0
 
mlmccCommented:
CR 11 is CR XI (R1 or R2)
CR XI does NOT have optional parameters

You must be using CR 2011

3.) I am trying to figure out how if they leave a parameter field blank it will just return all records.

Something like this should work

Not HasValue({?Param1})
OR 
Not HasValue({?Param2})
OR
(
    {YourFIeld} >= {?Param1}
     AND
    {YourField} <= {?Param2}
)

Open in new window



4.) In my Report Header I used imported an OLE Object (PDF) and my boss was wondering if there was some way to do this natively in Crystal to make it look better.

What do you better?

What does the PDF have?

mlmcc
0
 
Michael GrahamData AnalystAuthor Commented:
Thanks again.  I am not sure where to put these formulas.

Anyways, my boss wants me to write the OLE object manually so that is something I understand how to do it is just gonna be time consuming
0
 
James0628Commented:
We're talking about the record selection formula (Report > Selection Formulas > Record).  You presumably already have tests there that compare the parameters with the field (I think you got that much worked out in your other question about this).  If you're using optional parameters, just add the HasValue tests to that, as shown in mlmcc's post.  If only one of the parameters is optional, you only need to use HasValue on that parameter.

 James
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now