Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting field presence in dbf
Message
From
27/07/2007 13:46:14
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:
01244187
Views:
24
Hi Sergey

>Hi Mike,
>
>TYPE("FiledName) <> "U" always worked for me. I don't remember any case where performence was a consideration.
>I checked Fox 2.6 help and FIELD() function accepts only field # as first parameter and work area/alias as second.

I'm just curious. At the moment, FIELD() seems to be faster and more reliable as TYPE() will get confused if you give it an object.property name, right?

When did field start accepting the fieldname and not just a field number?

>
>>
>>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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform