> >*------------------------------------------------------------------------------ >* Procedure : IsFieldInTable >* Purpose : This procedure will return the position of a field in a table >* if the field exists in the table, otherwise it will return a zero. >* >* NOTE : This function could be made a little more efficient via the >* use of the FIELD function, however this function does double >* duty by indicating if the field exists (nonzero return value) and >* the position of the field in the table, which some of the calling >* routines make use of. >* >* Programmer: Thomas Ganss >* Commentary: Russell Campbell >* Copyright : BSD License >* Date : 10/29/2001 >* Revisions : >*------------------------------------------------------------------------------ >procedure IsFieldInTable >lparameters tcFieldName, tcTableName > > local MyFieldsArray[1], RtnVal > > if afields(MyFieldsArray, evl(m.tcTableName, alias()) > 0 > RtnVal = ascan(MyFieldsArray, alltrim(m.tcFieldName), -1, -1, 1, 7) > if m.RtnVal > 0 > RtnVal = asubscript(MyFieldsArray, m.RtnVal, 1) > endif > else > RtnVal = -1 > endif > >return m.RtnVal>