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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple optional parameters? 1

Status
Not open for further replies.

szander

IS-IT--Management
Jan 23, 2003
16
0
0
US
Can i use multiple optional parameters in a record selection formula? I have other selection criteria (not optional) as well.
If i use a single optional parameter and not hasvalue the selection will work fine, but how do i stack the hasvalue selections?

not hasvalue ({supplier}) or {item.supplier} = supplier and
not hasvalue ({prodgroup}) or {item.prodgroup} = prodgroup and
{item.qty.onhand} > 0 and
{item.inactive} = Y



When a selection is made in both parameters only the second one works. No error but the report will always select all records for supplier.

Thanks in advance,
 



Code:
[red][b](isnull[/b][/red]({supplier}) or {item.supplier} = supplier [red][b])[/b][/red]
and [red][b](isnull[/b][/red]({prodgroup}) or {item.prodgroup} = prodgroup [red][b])[/b][/red]
and{item.qty.onhand} > 0 
and{item.inactive} = Y

Is this what you mean?

I feel sorry for people who don't drink, when they wake up in the morning that's as good as the're going to feel all day!
 
No, the hasvalue does work for optional parameters (Crystal 2008). Isnull replies with the 'parameter has no value' error if no selection is made.
 
Use nothasvalue but use the parens as shown by NiceArms. They are critical.

-LB
 
That was it. I'm assuming my lack of proper parens was causing the not to extend into the rest of the formula?

Thanks!
 
No, actually it is the "or" statements that need to be clarified with parens.

-LB
 
I was so close to that star and yet so far ;p

I like the statement "if in doubt use parentheses". I use them for all my OR statements and it hasn't failed me yet. :D

I feel sorry for people who don't drink, when they wake up in the morning that's as good as the're going to feel all day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top