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

How to Specify Optional Critera (Multiple) using If-endif structure

Status
Not open for further replies.

ashishh

Programmer
Jul 19, 2002
43
US
Hi All,

I have a situation where I need to accept about 10 parameteters. They are not mandatory, but if they are entered, I need to filter the records based on each parameter. Example.

Param 1 : Compound
Param 2 : Protocol
Param 3 : Site

I am currently doing it in Record Selection Formula Editor.
I check for empty string '' to find out if they were entered or not. The if however will be very big because I am not able to specify multiple if-endifs. Crystal forces me to use if then else if. Which means, I should be checking for all 10 params in one big if condition.

Am I missing anything? How can I do the following
If not {?Compound} = '' then
tbl_Compound.Compound = {?Compound}
end if

If not {?Site} = '' then
tbl_Site.Site= {?Site}
end if

and so on.

Apparently if does not have any end ifs in CR.

Could someone please help me.

Thanks,
Ashish
 
Ashish,

Use something like:
------------------------------------------
({?Compound} = '' OR tbl_Compound.Compound = {?Compound})
AND
({?Site} = '' OR tbl_Site.Site= {?Site})
AND
...
------------------------------------------

Cheers,
- Ido
CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks Ido. This works. Apparently the way to do it is to join the if conditions with AND clause.

Thanks for the help.

Ashish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top