Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Simple WHERE clause filter not working. Post Reply Post New Topic
Author Message
kj27
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote kj27 Replybullet Topic: Simple WHERE clause filter not working.
     Posted: 15 Mar 2010 at 3:22pm

I'm actually developing a simple report using Version 8. This report goes against a SQL Server back-end, and has a grouping on Account ID's. The selection criteria for the entire dataset essentially goes against a table with 6 status fields. So in my group selection formula, I have simply added:

(<table_name>.status_1 = "Y") or (<table_name>.status_2 = "Y") or (<table_name>.status_3 = "Y")...

This generates the correct WHERE clause when I look at the SQL statement. And if I run the SQL statement directly, it generates 35 results. But in Crystal reports, only 26 results are brought back.

It seems that if I put the status_1 condition, then all records where status_1 = "Y" (regardless of whether other stauses are "Y") are brought back.

But if I physically put status_2 clause first (then the others) in the filter formula, only the records matching record_2 are selected.

I can't figure out what's missing here. Any help in this regard would be greatly appreciated.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Mar 2010 at 4:47am
Make sure you have the controll in the formula editor set to 'Defualt Values for NULLS'
IP IP Logged
kj27
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote kj27 Replybullet Posted: 16 Mar 2010 at 8:22am
Hey thanks a lot - that worked! This is just for anyone that may be facing the same issue:
 
Crystal Reports 8.5:
 
Go to: File > Report Options
Check on: Convert NULL Field Value to Default
 
Thanks!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Mar 2010 at 8:34am
For clarity there are 2 places to control this (at least in v.X or above).
You can control it for the entire report as indicated in your last post or you can do this per formula. There is a control in the upper-right hand corner of the formula editor that lets you flip this between 'Exceptions for Nulls' and 'Default Values for Nulls' per formula. It is nice when in one report you need to handle both circumstances and do not want to replace NULLS for the entire report.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum