Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

4 selection fields which may have Null data

Status
Not open for further replies.

fcullari

IS-IT--Management
Oct 28, 2002
30
US
I have to create a crystal report that will need to filter by 4 different selections: Factory, Source Order#, Style and Color. There can be nulls in any of the selections which will need to be skipped, and they want to be able to choose multiple selections on any of the selections.

I tried using a formula:
{Factory} = {?Factory} or
isnull {Factory} and
{Lot#} = {?Source Order} or
isnull {Lot#} and
ETC

But it did not work
 
Because of the way ands and ors are parsed, you'll have to use parentheses to get a valid result:

(isnull({Factory}) or {Factory} = {?Factory}) and
(isnull({Lot#}) or {Lot#} = {?Source Order}) etc.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Also note that Hilfy correctly tests for nulls first, this is a requirement in Crystal formula design.

-k
 
How do I put in a blank when I do not require the parameter, but want the rest of the conditions to run in the report? After coding like stated above, how do I allow blank as an option?
 
Put a blank in where?

I think that you should consider taking a more professional approach to posting here. Post your software, the database and example data as well as the expected output.

Do you mean that you want to enter a blank into the parameter, and in that instance skip filtering data?

If so, try:

(
if {?Factory} <> " " then
(isnull({Factory}) or {Factory} = {?Factory})
else
if {?Factory} = " " then
true
)
and
(
if {?Source Order} <> " " then
(isnull({Lot#} or {Lot#} = {?Source Order})
else
if {?Source Order} = " " then
true
)

Remeber that entering a blank means implies you hit the spacebar, not that you didn't enter anything.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top