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!

quick question on selecting "all" records from within an IF statement 2

Status
Not open for further replies.

demchak

IS-IT--Management
Jun 29, 2001
36
US
I have a few parameter fields in my report that have an "All" option. I would like to have my selection criteria based off of the field but it should not filter anything if "All" is selected but I am having trouble getting the results i want. Here is what i have

parameter field {?Division}
values "All","CB","CM"..etc
DB field {USERINFO.DIVISION}

(
if {?Division} = "All"
Then
{USERINFO.DIVISION} = "*"
else
{USERINFO.DIVISION} = {?Division}
)

This does not work as i get no results in my report.

Thanks for the help
 
Try this:

(
if {?Division} = "All" Then
true
else
{USERINFO.DIVISION} = {?Division}
)

-dave
 
By using {USERINFO.DIVISION} = "*" you're stating that you only want records where division explicitly equals "*".

Instead, try the following formula, which returns all values if the parameter selected = "All":

(
If
{?Division} <> &quot;All&quot;
Then
{USERINFO.DIVISION} = {?Division}
Else If
{?Division} = &quot;All&quot;
Then
True
)
 
Dave,that formula is simpler syntactically, but it won't pass off the processing to the database.

~Kurt
 
Lol, we're obviously posting at the same time

/cheers
 
Thanks again for the help guys. I should have been able to get that one on my own, must have been having a bad day.

Thanks
 
Here is another way to tackle 'All' and it also processes it much faster.

({USERINFO.DIVISION} = ( if {?Division}
<> "All"
then {?Division})
OR
{USERINFO.DIVISION} > ( if {?Division}
= "All"
then "" else 'zzzzzzz'))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top