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

How to handle parameter data

Status
Not open for further replies.

jsttuchm3

Technical User
Apr 6, 2010
16
US
My report extracted based on parameters. There are about 12 parameters. Few of the parameters will be initially set to default values in parameter section like 'ALL'.
ALL - means no filter on that field, problem here is the field is null in the DB. How to handle this is Record Selection section validation.
With the following code in between other validation the query is returing no rows.

(
If {param-1} = 'ALL' then
{report.field-1} like '*'
else
{report.field-1 = {?param-1}
)
and
(
If {param-2} = 'ALL' then
{report.field-2} LIKE '*'
else
{report.field-2} = {?param-2}
)
and
(
If .......
.....
...
(
if {param-5} = 'ALL' then
{report.field-5} LIKE '*'
else
{report.field-5} = {param-5}
)

In this conditon if database is having null values though ALL is set as defalut value in parameter creation part this is fetching any records.
When i query database with IS NULL it retrieves data. Its confirmed that it is null. I need to enforce in the query in crystal to retieve all the records. It is string data type.
It is null now, will have data later.
How to handle this scenario.
Four conditions before this condition are working properly and 2 below this are working fine. Because of this having null values in DB the entire report returns no records.
There are 2 more fields which have null values in DB.

How to retieve data though few parameters have null data in DB and are set to default like ALL in parameters to retrieve data.

Thanks.
 
Change logic around

(if {param-5} <> 'ALL' then
{report.field-5} = {param-5}
else true)

Thus you do not have to test contents of field for all.

Ian
 
It doesn't work. Its looking for the else part to have something for the parameter.
In my scenario,
If {param-5} <> 'ALL' then
{report.field-5} = {?param-5}
else
I want all the records to be considered including NULL values for the field.
{report.field-5} Like '*' / {report.field-5} = ' ' / {report.field-5} = null}
none of these works here.
 
Thats why I used else True.

This effectively removes the filter and will bring back all records.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top