Lan Cui
Lan Cui

Reputation: 137

How to get all records from Crystal Report using default parameter values

I have a Crystal Report which has two paramaters: {?EmailVerifyStatus} and {?Company}. I want it so that when the two paramaters are blank the report gets all the records. Here is my current code:

    (if {?EmailVerifyStatus}='Y' THEN {PREH.udEmailVerify}='Y' 
     ELSE IF {?EmailVerifyStatus}='N' THEN {PREH.udEmailVerify}='N' 
     ELSE  1=1) 
    and

   (if {?Company} <> '0' then not (IF "," & ToText({PREH.PRCo},0,'') & "," IN "," & {?Company}  & "," THEN 0=1 ELSE 1=1) else 1=1 ) 

But, it is only returning the records with a 'Y' value.

Upvotes: 0

Views: 649

Answers (1)

Robert Niestroj
Robert Niestroj

Reputation: 16131

You have to check if parameters have set a value with the hasvalue() function. Then you can do this:

(not(hasvalue({?EmailVerifyStatus})) or {PREH.udEmailVerify} = {?EmailVerifyStatus}) and
(not(hasvalue({?PRCo})) or {PREH.Co} = {?Company})

I dont understand your second condition ...

Upvotes: 1

Related Questions