iif(vartype(oJC)="O",GetDescription(oJC.CustomerID,"Customer","CustomerID","CustomerName"),"Test Customer")Where GetDescription is a common UDF I designed for returning field value from a table.
*!*********************************************************************** function GetDescription * Description.......: Function returns description * Calling Samples...: GetDescription(town,"TOWNS","code",'FullName') * Parameter List....: tcCode, tcTable, tcIndex, tcFldName, tReturnValue, tcRetType * Created by........: Nadya Nosonovsky 11/3/99 * Modifyed by.......: Nadya Nosonovsky 12/20/2000 01:42:50 PM *************************************************************************** lparameters tcCode, tcTable, tcIndex, tcFldName, tReturnValue, tcRetType && Last two parameters are optional local lDescript, llUsed, lnParmCount, lcExpression, lcRetType lnParmCount=pcount() llUsed=.t. if m.lnParmCount=5 && Exists optional parameter lDescript=m.tReturnValue endif if !used(m.tcTable) llUsed=.f. =OpenTble(m.tcTable, m.tcTable, 'shared noupdate') endif lcExpression=m.tcTable+'.'+strtran(m.tcFldName,'+','+'+m.tcTable+'.') && For multiple fields if !empty(m.tcRetType) and vartype(m.tcRetType)='C' lcRetType=m.tcRetType else lcRetType=type(m.lcExpression) endif do case case inlist(m.lcRetType,"C","M") && Character or Memo lDescript="" case inlist(m.lcRetType,"N","I","B") && Numeric, Integer, Double lDescript=0 case inlist(m.lcRetType,"D","T") && Date, DateTime lDescript={} case lcRetType='L' && Logical lDescript=.f. otherwise =messagebox('Invalid Field Name passed!',48,'GetDescription Function Failed') return '' endcase if !empty(m.tcCode) and !isnull(m.tcCode) and seek(m.tcCode,m.tcTable,m.tcIndex) lDescript=evaluate(m.lcExpression) else if !empty(m.tReturnValue) lDescript=m.tReturnValue endif endif if !m.llUsed use in select(m.tcTable) endif return m.lDescript