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

null and not null formula

Status
Not open for further replies.

lareya

Technical User
Jan 30, 2003
49
US
Okay, I guess I don't quite understand null. Here is the problem. I have a forumula that checks if a bovie is being used or not. This formula works.

Code:
if
( isnull({WP_CAUTERY_DTL.SERIAL_NO_CODE}) 
)
then
"No Bovie" 
else
'bovie used'
However if I try this forumula (not null) then it doesn't work.

Code:
if
(not isnull({WP_CAUTERY_DTL.SERIAL_NUMBER}
)
then

"bovie used"
else
' No Bovie'

Why doesn't the not null work? This is really frusterating!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v10.1.2; Huge Newbie to Crystal! Operating Room RN Analyst
 
First, these can't be your actual formulas, since the parens would cause an error. Secondly, you are using two different fields for the comparison. You might want to place both fields in the detail section and observe when one or both are null.

-LB
 
Okay, I was trying to cut and paste the extraneous info in my formula, thus the mistake in the field name. Here is the full formula. It checks first if the bovie is used, then it checks if the coag & cut is being used, then all the code checks are for bovie pad placement. Thus

{WP_CAUTERY_DTL.SERIAL_NO_CODE} is the bovie
{WP_CAUTERY_DTL.SERIAL_NUMBER} is coag
{WP_CAUTERY_DTL.COAG_RANGE} is cut
{WP_MISC.CODE_09}.... are the pad placements

My problem is that when the bovie is NOT used it should be blank. But I still get a "please check a bovie pad" error message. However, I also get the correct message stating that the "bovie not used formula 2"

I am perplexed of why?

Code:
WhileReadingRecords;
 Local StringVar strValidate2;
 (

if 
(
({WP_CAUTERY_DTL.SERIAL_NO_CODE} = [1,2,3,4,5,6,7,8,9] ) 

and 
   (isnull ({WP_CAUTERY_DTL.SERIAL_NUMBER}) or {WP_CAUTERY_DTL.SERIAL_NUMBER} = "") and
   (isnull ({WP_CAUTERY_DTL.COAG_RANGE}))  or {WP_CAUTERY_DTL.COAG_RANGE} = "" )  
   
 and 
(
(isnull({WP_MISC.CODE_09}) or   {WP_MISC.CODE_09} = 0)  and
(isnull({WP_MISC.CODE_16})  or  {WP_MISC.CODE_16} = 0)  and
(isnull({WP_MISC.CODE_13})  or  {WP_MISC.CODE_13} = 0 ) and
(isnull({WP_MISC.CODE_10}) or   {WP_MISC.CODE_10} = 0 ) and
(isnull({WP_MISC.CODE_14})  or  {WP_MISC.CODE_14} = 0)  and
(isnull({WP_MISC.CODE_15}) or   {WP_MISC.CODE_15} = 0)  and
(isnull({WP_MISC.CODE_12})  or  {WP_MISC.CODE_12} = 0 ) and
(isnull({WP_MISC.CODE_11})  or  {WP_MISC.CODE_11} = 0 ) and
(isnull({WP_MISC.STRING_21})  or {WP_MISC.STRING_21} = '' ) 
)
then
 if strValidate2 = "" Then
        strValidate2 := 'Please check a bovie pad' 
   else         strValidate2 :=  strValidate2 & chr(13)& chr(13)  & 'Please check a bovie pad';

if

({WP_CAUTERY_DTL.SERIAL_NO_CODE} = [1,2,3,4,5,6,7,8,9] )

then
 if strValidate2 = "" Then
        strValidate2 := "bovie used formula 1"
   else         strValidate2 :=  strValidate2 & chr(13)& chr(13)  & "bovie used formula 1";

if
( 
isnull({WP_CAUTERY_DTL.SERIAL_NO_CODE}) or {WP_CAUTERY_DTL.SERIAL_NO_CODE} = 0)  
then
 if strValidate2 = "" Then
        strValidate2 := "bovie Not used formula 2"
   else         strValidate2 :=  strValidate2 & chr(13)& chr(13)  & "bovie Not used formula 2";

  
   );

strValidate2;

I figure i should not get a error msg regarding bovie pad and also get the "bovie not used" message when the bovie is NOT used. I will only use the error msg in the report, but put in the other messages so I can try and see what the problem is.

TIA

Lareya

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v10.1.2; Huge Newbie to Crystal! Operating Room RN Analyst
 
I'm not sure I follow all of this, but you should always check for nulls first. So your last if-then statement should appear first in the formula. Also note that you have a paren in the wrong place (I think) here:

(
isnull ({WP_CAUTERY_DTL.COAG_RANGE})
) //incorrect paren
or
{WP_CAUTERY_DTL.COAG_RANGE} = ""
)

This means you also have an incorrect open paren somewhere else.

-LB
 
Okay, I thought that each of the different if-then-else statements that are separated by the ; means that they start over. Is that right? All the formulas are not interdependent. They are checking the same fields, but the formulas do not depend on each other. I thought it is checking first for the null field. But hey, I am getting very confused over this. I am just unsure how/where to place the formula. In the report the results looks like this:

Please check a bovie pad
Bovie not used formula 2

When infact, if the bovie isn't used, then it shouldn't have a bovie pad.

I have fashioned these formulas from our previous discussion:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v10.1.2; Huge Newbie to Crystal! Operating Room RN Analyst
 
Okay, I thought that each of the different if-then-else statements that are separated by the ; means that they start over. Is that right? All the formulas are not interdependent. They are checking the same fields, but the formulas do not depend on each other. I thought it is checking first for the null field. But hey, I am getting very confused over this. In the report the results looks like this:

Please check a bovie pad
Bovie not used formula 2

When infact, if the bovie isn't used, then it shouldn't have a bovie pad.

I have fashioned these formulas from these previous discussion:

I have a feeling I am missing something important here.
TIA

Lareya

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Crystal 8.5; SQL database; MS Windows 2K; ORSOS/One Call Hospital Scheduling System v10.1.2; Huge Newbie to Crystal! Operating Room RN Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top