Sunday, March 11, 2012

CR not evaluating NULL values in formula

I have a data set where I am looking for a person's name and title. In some cases though either a title or a name was not entered. When this happens CR does not evaluate it in a formula I have built. Is there a trick to getting CR to evaluate Nulls in a particular formula or am I missing somthing in my initial formula?

Thanks in advance.

Formula (finds the persons title but only if the title value is NOT NULL):
----
'**********************
'Psychiatry/Psychology
'**********************
If (InStr({Concurrence.ConcurrenceTitle}, "Psychol", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "psychia", 1) > 0) then
formula = "Psychiatry/Psychology"

'****************
'Radiology
'****************
ElseIf (InStr({Concurrence.ConcurrenceTitle}, "Radiol", 1) > 0) then
formula = "Radiology"

'****************
'Patient Safety
'****************
ElseIf (InStr({Concurrence.ConcurrenceTitle}, "Patient Safety", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "PSM", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "PSO", 1) > 0 _
or InStr({Concurrence.ConcurrenceTitle}, "PSC", 1) > 0 _
or (InStr({Concurrence.ConcurrenceTitle}, "PAT", 1) > 0 _
and InStr({Concurrence.ConcurrenceTitle}, "SAFETY", 1) > 0) _
or (InStr({Concurrence.ConcurrenceTitle}, "PT", 1) > 0 _
and InStr({Concurrence.ConcurrenceTitle}, "SAFETY", 1) > 0) _
or (InStr({Concurrence.ConcurrenceTitle}, "PS", 0) > 0 _
and InStr({Concurrence.ConcurrenceTitle}, "MANAGER", 1) > 0)) then
formula = "Patient Safety"

'*************************
'All other entries
'*************************
ElseIf (IsNull({Concurrence.ConcurrenceTitle}) _
or Trim({Concurrence.ConcurrenceTitle}) = "") then
formula = "No entry"

Else
formula = "Other"

End IfTry putting the NULL test as the very first test. Crystal seems to be funny about this sometimes.

No comments:

Post a Comment