Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting field presence in dbf
Message
 
To
29/07/2007 02:53:24
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01244177
Message ID:
01244419
Views:
20
I'm not sure I get your point. I don't know if you're poking fun at the minor, insignificant changes that some people want to apply to example code, or if you're making a serious statement. Ultimately, the small changes you made are inconsequential. IMHO, some of them make the routine less obvious. But, as I said, I can't determine if you're serious or not.

>Russel,
>
>as this thread is on nearly always unnecessary micro-optimization, let me "optimize"<g>
>
>*------------------------------------------------------------------------------
>* 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
>
>regards
>
>thomas
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform