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!

Parameters 1

Status
Not open for further replies.

EdwinBB

Programmer
Aug 25, 2006
9
CA
It's me again!

Crystal Rep XI
Oracle 9i

I have five parameters say, Invoice_No_FRom, INvoice_No_To, INvoice_date_from and Invoice_No_to and INVOICE_TYPE. I will be using all these parameters for my Selection Expert section but then, how can i make my formula work so that if they entered NULL for INVOICE_NO_FROM and INVOICE_N0_TO it will still run the report based on the remaining parameters that the user entered.
This is the deault when u sue the selection expert:

{xxx.INVOICE_NO} BETWEEN ?INVOICE_NO_FROM to ?INVOICE_NO_TO and
{xxx.INVOICE_DATE} BETWEEN ?INVOICE_DATE_FROM to ?INVOICE_DATE_TO and
{xxx.INVOICE_TYPE}= ?INVOICE_TYPE

What i wanna achieve is, if other parameters are null then do the selection of records based on NON-NULL parameters.

Thanks in advance.

Ed



 
You can't enter null values for parameters. The normal solution is to have an extra parameter saying 'all' - ratehr, one for account numbers and another for dates. You can then select based on tests, though it is better to put such tests as 'boolians', formual fields without an 'if' that will return True or False.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Set up the invoice number parameters to use 0 as a default, and the date parameters to default to some date like 9999-09-09. Then change your record selection formula to:

(
if ?INVOICE_NO_FROM <> 0 then
{xxx.INVOICE_NO} >= ?INVOICE_NO_FROM else
if ?INVOICE_NO_FROM = 0 then true
) and
(
if ?INVOICE_NO_TO <> 0 then
{xxx.INVOICE_NO} <= ?INVOICE_NO_TO else
if ?INVOICE_NO_TO = 0 then true
) and
(
if ?INVOICE_DATE_FROM <> date(9999,9,9) then
{xxx.INVOICE_DATE} >= ?INVOICE_DATE_FROM else
if ?INVOICE_DATE_FROM = date(9999,9,9) then true
) and
(
if INVOICE_DATE_TO <> date(9999,9,9) then
{xxx.INVOICE_DATE} <= ?INVOICE_DATE_TO else
if INVOICE_DATE_TO = date(9999,9,9) then true
) and
{xxx.INVOICE_TYPE}= ?INVOICE_TYPE

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top