Spencer R
Spencer R

Reputation: 1158

Formula field displays blanks instead of desired result

I'm stuck on a problem with a formula field in Crystal Reports and I keep going around in circles. I'll try my best to explain it.

The report I'm creating will be exported as a data file. It uses 3 tables, with work_table as the main table. work_table is joined to a view called order_item_with_aux using two fields, orderhdr_id and order_item_seq; it's an inner join. I don't think this has much bearing on my problem but, work_table is also joined to the customer_address table on customer_id and customer_address_seq.

In my output, I've included several fields from all three tables. Where I'm stuck is creating a formula field to populate a @Split field. Here's what I'm writing in my formula:

if {order_item_with_aux.zzaux_no_renewal_notices} = "Y" then "B"
else {work_table.split_value}

This results in the @Split field being populated with "B" for records on the work_table whose corresponding record on the order_item_with_aux view has zzaux_no_renewal_notices equal to "Y". The value of @Split for all other records displayed is blank. I've tried several variations of the above formula all to no avail. I've also tried setting a variable and handling it that way, but again, no go.

Anyone have any ideas? Please let me know if there's more info I can provide.

Upvotes: 0

Views: 2277

Answers (1)

craig
craig

Reputation: 26262

You need to test for null values first:

if isnull({order_item_with_aux.zzaux_no_renewal_notices}) then
  "missing value"
else if {order_item_with_aux.zzaux_no_renewal_notices} = "Y" then 
  "B"
else 
  {work_table.split_value}

Upvotes: 2

Related Questions