And this is what I'm trying that doesn't work:
CASE WHEN NVL({type},'X') IN ('Assembly Build', 'Deposit', 'Journal') THEN RTRIM(LPAD({entity}, 4)) WHEN NVL({type},'X') IN ('Cash Sale', 'Credit Memo', 'Item Fulfillment') THEN {customer.internalid} WHEN NVL({type},'X') IN ('Expense Report') THEN {employee.entityid} ELSE {vendor.internalid} END