Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select records using crystal report with null condition

I was trying to filter the data in database with the following formula in my crystal report and one of the condition is to included the data even this, '{vw_CandidateProfile.Type}' is null or empty string. But the formula below doesn't work. Any ideas?

{vw_CandidateProfile.Candidate_Code} = '881225095228' 
AND (
        {vw_CandidateProfile.Type} IN ['NGO','EDU','PRS','PPR','PPS','TTL','OTH'] 
        OR ISNULL({vw_CandidateProfile.Type})
    )
like image 741
Fire Hand Avatar asked Dec 08 '10 02:12

Fire Hand


People also ask

IS NULL condition in Crystal Report formula?

IIF and IsNull are functions in Crystal Reports that are used in formulas to test fields for blanks, empty strings, missing values and NULL, then return some valid output. This is especially helpful when preparing a report, since these values can cause blank lines to be printed.

How do you check the null value in Crystal Report formula field?

To ensure the formula is always evaluated when there is null data, always use the function: IsNull, as the first comparison for the database field. An alternative to using the function IsNull in a formula is to check the report option "Convert Database NULL Values to Default".

IS NOT NULL condition in Crystal Report?

If value isn't null, your code should put it into the shared variable. If it is null, your code can safely ignore it and do nothing.


1 Answers

I have found the solution in which the IsNull() field has to comes before the field which is no IsNull().

{vw_CandidateProfile.Type} IN ['NGO','EDU','PRS','PPR','PPS','TTL','OTH'] 
    OR ISNULL({vw_CandidateProfile.Type})

becomes

ISNULL({vw_CandidateProfile.Type})
    OR {vw_CandidateProfile.Type} IN ['NGO','EDU','PRS','PPR','PPS','TTL','OTH'] 
like image 153
Fire Hand Avatar answered Oct 11 '22 15:10

Fire Hand