>Hey all
>
>Some time ago I think Fabio Lunardon demonstrated using fsize to check for the presence of a field. What thread was that? I can't find it though I looked.
>
>Considering the need to manage SET COMPATIBLE for a UDF to use FSIZE I can't see it being the fastest way.
>
>I have used a UDF based on TYPE() and it is faster than a UDF using FSIZE that also handles setting and resetting SET COMPATIBLE. I think I found FIELD() is faster.
>
>There is another consideration. Using a UDF can be slow, so using an idea that is in my FoxPro Advisor article:
http://advisor.com/doc/17440, the command that can detect a field with the fewest external dependencies could be directly injected into code. It seems the easiest and fastest is to use FIELD().
>
>Did FIELD() always accept the fieldname and alias?
with an ALIAS the VARTYPE can to be faster
CLEAR
CREATE CURSOR AAA (kyWarrant G)
LOCAL lnSec, llCheck
FOR i = 1 TO 1000000
NEXT
lnSec = SECONDS()
FOR i = 1 TO 100000
NEXT
looptime=(SECONDS() - lnSec)
lnSec = SECONDS()
FOR i = 1 TO 100000
llCheck = FSIZE('kyWarrant','AAA')>0
NEXT
? 'FSIZE',(SECONDS() - lnSec-looptime),llCheck
lnSec = SECONDS()
FOR i = 1 TO 100000
llCheck = FIELD('kyWarrant','AAA')#''
NEXT
? 'FIELD',(SECONDS() - lnSec-looptime),llCheck
lnSec = SECONDS()
FOR i = 1 TO 100000
llCheck = vartype(AAA.kyWarrant)<>'U'
NEXT
? 'VARTYPE',(SECONDS() - lnSec-looptime),llCheck
lnSec = SECONDS()
FOR i = 1 TO 100000
llCheck = type('AAA.kyWarrant')<>'U'
NEXT
? 'TYPE',(SECONDS() - lnSec-looptime),llCheck
USE