Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting field presence in dbf
Message
From
27/07/2007 14:47:50
Mike Yearwood
Toronto, Ontario, Canada
 
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:
01244223
Views:
20
>>>I know that, of course.
>>>
>>>But type('FieldName')<>'U' would not tell us whether we have a field 'fieldname' in the currently opened alias, if we have a variable with this name.
>>>
>>>That's the point I tried to make.
>>>
>>>In other words, the above test will only tell us that we may have either a variable or a field name called 'fieldname' while field() will remove ambiguity.
>>
>>If you expect conflict between a field name and memory variable, always use alias prefix.
>
>
>LOCAL lnSec, llCheck
>lnSec = SECONDS()
>FOR i = 1 TO 100000
>  llCheck = not EMPTY(FIELD('kyWarrant'))
>NEXT
>=MESSAGEBOX(SECONDS()  - lnSec)
>lnSec = SECONDS()
>FOR i = 1 TO 100000
>  llCheck = type('kyWarrant')<>'U'
>NEXT
>=MESSAGEBOX(SECONDS()  - lnSec)
>
>So field() will outperform type also.

Like I said! :) I have a more complete program to contrast speed of UDF using type, field and fsize which I'll post later. It certainly makes it clearer what's happening too.
Previous
Reply
Map
View

Click here to load this message in the networking platform