We help IT Professionals succeed at work.
Get Started

Ignore parameter if no value entered

MikeM670
MikeM670 asked
on
1,379 Views
Last Modified: 2016-09-08
Crystal Reports IX
SQL 2014

I have a report with multiple parameter values.  There are four parameter's that check on single field.  I want to allow the report to ignore any of the second, third or fourth parameter's that are left blank if they are not needed in the query.

First the field I wish to search:
Table: CaseMaster
Field: UCRCodeAll  varchar()   Allows Nulls but would need to check for both NULLS or ""

A hardcoded query looks like this:
(({CaseMaster.UCRCodeAll} like "*8028*") or ({CaseMaster.UCRCodeAll} like "*5060*"))

A Parameter based query that requires the user to enter a value.
(({CaseMaster.UCRCodeAll} like "*" & {?UCR Code 1} & "*")
or ({CaseMaster.UCRCodeAll} like "*" & {?UCR Code 2} & "*"))

UCRCodeAll data looks like this:

     UCRCodeAll
            8028
            5060,8028
            5060,0100,4002
            0100,3534

Data would be returned on the 1st - 3rd row.


The parameter fields are:
UCR Code 1
UCR Code 2
UCR Code 3
UCR Code 4
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 22 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE