Solved

Crystal Reports 11 Multiple Parameters on same field

Posted on 2016-09-20
9
41 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 34

Expert Comment

by:James0628
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Michael Graham
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now