We've created a data entity to provide details of vendor transactions, and one of the fields required on the data entity is the vendor type (organisation or person). Party base type doesn't seem to be a database field (happy to be told I'm missing something), so we've ended up with a computed field in the data entity that feels more clunky than I'd like. Other than better use of SysComputedColumn to construct the outer joins, anyone have a smoother way to get this please?
public class CUSVendorTransactionEntity extends common { public static server str VendorPartyType() { DataEntityName dataEntityName= tablestr(CUSVendorTransactionEntity); str AccountNum; str qry; accountNum = SysComputedColumn::returnField(DataEntityName, identifierstr(VendTrans), fieldstr(VendTrans, AccountNum)); qry = strFmt("select case when dpn.[recid] is null then 'Organisation' else 'Person' end from [VENDTABLE] vt inner join [DIRPARTYTABLE] dpt on vt.[PARTY] = dpt.[RECID] left outer join [DIRPERSONNAME] dpn on dpt.[RECID] = dpn.[PERSON] where vt.[ACCOUNTNUM] = %1", accountNum); return qry; } }