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

Need isnull within select statement

Status
Not open for further replies.

littleress

Technical User
Apr 10, 2008
21
US
I have a statement where currently it pulls a list of payments that were pulled that day, but I need it also to make sure that a certain payment id is null.

Currently:
{MPT.CLUB_ID} = {?Club_ID} and
{MPT.TRANSACTION_DATE} >= {?begin_date_range} and
{MPT.TRANSACTION_DATE} <= {?end_date_range} and
{MPT.PRODUCT_ID} = 9000 and
{MPT.STATUS} = "C" and
{MPT.RECEIVED_AT_CLUB} = "Y"

And I need something added that says isnull({MPT.INSTANT_PAY_ID})
But everytime I add it - it loses the data. So can anyone see what I might be doing wrong that it won't take and isnull field??
 
isnull({MPT.INSTANT_PAY_ID}) and
{MPT.CLUB_ID} = {?Club_ID} and
{MPT.TRANSACTION_DATE} >= {?begin_date_range} and
{MPT.TRANSACTION_DATE} <= {?end_date_range} and
{MPT.PRODUCT_ID} = 9000 and
{MPT.STATUS} = "C" and
{MPT.RECEIVED_AT_CLUB} = "Y"

However, are you sure the other fields are populated when the PayId is null? I think you shold lay out your fields in the detail section and see what values other fields have when PayID is null.

-LB
 
If it loses the data, then maybe the field is always null. Try doing a boolian formula field,
Code:
isnull({MPT.INSTANT_PAY_ID})
Don't select, but display it with the data. If it always says 'True', then the computer is doing just what you asked and the data is the problem.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you. I will try this. My biggest dilemna is that if I take that exact query and run it in Toad, it works fine. Some days I think Crystal tries to make me crazy!!! I appreciate your replies.
 
In Crystal, null checks in a formula must always precede any reference to the potentially null field--so a good practice is to place the null checks first.

-LB
 
If the NULL criteria works in TOAD but not in Crystal then it could be that your report options are set to convert the nulls to the default string "". Maybe you don't have any NULL values in the report even though they are NULL in the database.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
A sensible test would be
Code:
isnull({MPT.INSTANT_PAY_ID})
or
{MPT.INSTANT_PAY_ID} = ""

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top