Solved

Crystal Reports 11 Multiple Parameters on same field

Posted on 2016-09-20
9
66 Views
Last Modified: 2016-09-27
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
Comment
Question by:Michael Graham
  • 4
  • 3
  • 2
9 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 41808617
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
 
LVL 34

Expert Comment

by:James0628
ID: 41809836
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
 

Author Comment

by:Michael Graham
ID: 41809871
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
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 34

Expert Comment

by:James0628
ID: 41809885
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
 

Author Comment

by:Michael Graham
ID: 41809895
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
 
LVL 34

Expert Comment

by:James0628
ID: 41809900
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
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
ID: 41809922
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
 

Author Comment

by:Michael Graham
ID: 41809928
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
 
LVL 34

Accepted Solution

by:
James0628 earned 250 total points
ID: 41809998
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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