If-Then-Else clause: Order of terms

Hi guys,

this is a quite simple If-then-else clause:

if isnull({S_OPTY.YARD_ID}) and ({S_OPTY.Primary_ID} = {S_OPTY.MANAGER_ID} or {S_OPTY.Primary_ID} = {S_OPTY.OWNER_ID})
then “Owner/Manager”
else “Others”

The situation:
Case1: The Primary ID = the Manager ID. Owner ID and Yard ID are empty.
Case 2: The Primary ID = the Owner ID. Manager ID and Yard ID are empty.

For case1, the result of the formula is “Owner/Manager”.
For case2, the result will be “”. That’s false. The result must also be “Owner/Manager”.

If I change the order of the “or”-terms in the brackets, the results would be vice versa. (Case1: “”, Case2: “Owner/Manager”)

Why this? It seems that the order of or-terms is important for Crystal. Is there any solution to avoid this?

Thx a lot in advance and best regards.
IDr


IDr (BOB member since 2009-10-20)

Hi,

It seems there are null values in the fields. Whenever a null is encountered Crystal does not evaluate the formula.

If you are using Crystal Reports XI then change the settings for the formula. In the formula workshop there are 2 options Exception for NULLS and Default for NULLS. Change the setting to default to NULLS.

Alternatively go to File menu>>Report Options>> Check Convert Database NULL to default and Convert other NULL to default

Cheers!!!
Manish


cr_manish :india: (BOB member since 2009-07-30)

Great! It works!!! Thanks a lot.

You make my day.


IDr (BOB member since 2009-10-20)