0
votes

I am having an issue with the result of the formula below in crystal reports. Due to the type of join there are instances where the table "CustomerLocation" may be null. To correct for this I constructed the formula below to return a field that is valid if the Location table is null. I have verified that the Customer.CustomerName field does have a value, and simply dragging the field to the report does show this to be the case. Why am I always returning an empty string from this formula?

if {CUSTOMER.ID#} = 2075 or {CUSTOMER.ID#} = 2454 then
(
    {tblOrderHeader.BillName}

)
else if {CUSTOMERLOCATION.Customer Name} = "" or IsNull({CUSTOMERLOCATION.Customer Name}) = true then
(    
{CUSTOMER.CustomerName}
)       
else
(
{CUSTOMERLOCATION.Customer Name}
)
1
Try this instead - if {CUSTOMERLOCATION.Customer Name} = "" or IsNull({CUSTOMERLOCATION.Customer Name}) then ({CUSTOMER.CustomerName}) else if {CUSTOMER.ID#} in ['2075','2454'] then ({tblOrderHeader.BillName}) else({CUSTOMERLOCATION.Customer Name}) -- the syntax of your formula looks correct. I have found the behavior can change depending on which condition is evaluated first.Aron
Thanks! That was the fix, crazy how a little a tweak to the order resolves this. I Cant mark as answer yet but thanks for the solution.HighARc

1 Answers

0
votes

if {CUSTOMERLOCATION.Customer Name} = "" or IsNull({CUSTOMERLOCATION.Customer Name})

then ({CUSTOMER.CustomerName})

else if {CUSTOMER.ID#} in ['2075','2454']

then ({tblOrderHeader.BillName})

else ({CUSTOMERLOCATION.Customer Name})