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

Setting a parameter as optional 1

Status
Not open for further replies.

maryellc

MIS
Nov 7, 2003
25
US
Using CR8.5 I have a report with several parameters (date from/to, employee id, department and absence code), some of which I want to be optional. For example, the user must select a date range and may want to select a specific empid or department or multiple absence codes.

I tried the suggestion on a previous post to do the following for each parameter:

If isnull({?Employee ID}) then
True
else
{TBLEMPLOYEE.EMPID} = {?Employee ID}

but am still stopped upon run-time to enter a value in each of the parameter fields that I do not want.

Any thoughts/suggestions would be appreciated.
 
I'd suggest setting a default value for the parameters, as I don't think that a isnull() check on a parm will return a true unless you're using the RDC to check it (I seem to recall that it returned true there, but I'm not positive).

Place a default value for the EMP ID that is out of bounds for the database, such as:

999999999

Try using the following in the record selection formula:

(
If {?Employee ID} <> 999999999 then
{TBLEMPLOYEE.EMPID} = {?Employee ID}
True
else
If {?Employee ID} = 999999999 then
true
)
and
...

Note that I intentionally fully qualify both If conditions, this is done to assure the SQL pass through (Check the Database->Show SQL Query to make sure that your SQL reflects the reocrd selection formula, otherwise performance suffers).

-k
 
Oooops, I see that I inadvertently left a True in the first If clause, nuke it.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top