>*------------------------------------------------------------------------------ >* Procedure : FieldNumInAlias >* 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. >* if Alias is not available, it will return -1 >* >* NOTE : This function could be made a little more efficient via the >* use of the FIELD function, however this function does triple >* duty by indicating >* if the alias exists (positive or zero return value) and >* if the field exists (positive 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, Thomas Ganss >* Copyright : BSD License >* Date : 10/29/2001 >* Revisions : >*------------------------------------------------------------------------------ >function FieldNumInAlias(tcField, tuAlias) > local laFieldsArray[1] > #if .t. && Have not tested, which options are faster (might depend on fieldnum!) > return iif (afields(laFieldsArray, evl(m.tuAlias, alias())) > 0 ; > , ascan(laFieldsArray, upper(alltrim(m.tcField)), 1, -1, 1, 14) ; > , -1) > #else > return iif (afields(laFieldsArray, evl(m.tuAlias, alias())) > 0 ; > , ascan(laFieldsArray, alltrim(m.tcField), 1, -1, 1, 15) ; > , -1) > #endif>