Expression for populating data field based on another data fields value in a despatch note

SOLVED

Hi,

I am trying to set up an expression for a layout whereby if field 1 on the report contains an order number then field 2 should be blank and if field 1 contains no information then field 2 should populate.

Field 1 gets it information from SALES_ORDER.CUST_ORDER_NUMBER and field 2 is looking at SOP_ITEM.EXT_ORDER_REF

The reason for this is that I have some customers who order multiple items, each with a seperate order number, and I need to show this information on the despatch note against each line/item number.

Where a customer places an order for multiple items with one order number I would use the despatch note as it stands with SALES_ORDER.CUST_ORDER_NUMBER populating.

Where the order is for multiple items each with their own order number I would leave SALES_ORDER.CUST_ORDER_NUMBER blank on order entry and input the individual items order numbers in the "order reference" field in the extended description feature.

The expression I have so far is - SALES_ORDER.CUST_ORDER_NUMBER = null ? SOP_ITEM.EXT_ORDER_REF : SALES_ORDER.CUST_ORDER_NUMBER

This works if SALES_ORDER.CUST_ORDER_NUMBER is blank, i.e  the individual order numbers appear in the expression field however if an order number is in SALES_ORDER.CUST_ORDER_NUMBER then that same order number appears in the expression field and I don't want this. The expression field should be blank if SALES_ORDER.CUST_ORDER_NUMBER is populated.

Can anybody help?

Regards

Andy