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!

How to run crystal report against paramtere or noparam

Status
Not open for further replies.

Rajesh99

Programmer
Mar 17, 2003
43
US
I create a report passing parameter. That works fine. Problem is that users may not even pass parameter every time when they run this report, likemthey want to see all results. So Itry codeing where clause like:

cust_id = NVL(?cust_param,cust_id)

NVL is an oracle function that says if parameter is null evaluate above as
cust_id=cust_id. That definitely does not work as CR does not like Oracle special functions there. How do I accomplish this.

Basically, how t program so that parameters becoem optional
while running a report.


Thanks
 
Rather than assuming that a parameter is null (Crystal does things differently), set a default value for the parameter of "All" (click set default values to add it) and then check for that value in your code, as in:

(
if (?cust_param,cust_id) <> "All" then
{table.field} = (?cust_param,cust_id)
else
if (?cust_param,cust_id) = "All" then
true
)

Note that I purposely used a fully qualifying else condition to assure SQL pass through to the database.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top