Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning the field name associated with tag
Message
From
31/01/2002 01:23:58
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
30/01/2002 16:59:48
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00613089
Message ID:
00613204
Views:
10
>How can I get the field name associated with an index tag.
>
>For example: the KEY() function returns the index expression, but is there a function to return the field name that the tag belongs to?
>
>If I: INDEX ON UPPER(myfield) TAG mytag, ?KEY('mytable', 1) returns UPPER(myfield). I only want the field myfield returned.

You could adjust one of the parsers offered to match only full words, but the point is that the tag doesn't belong to a field. It is possible, and most commonly done, to use just one field while building the tag, but that doesn't tie the tag to the field, or vice versa. One tag may use several fields in its index expression (or none), and one field may be used in zero or more index expressions.

If you really need to know if a particular field is involved in an index expression, I'd suggest adapting Mark's approach, with the addition of slicing any index expression into just words, like in chrtran(key(), "!#$%&()=+*/[]", space(13)), and then scan it using GetWordCount and GetWordNum (aka Words() and Wordnum() in FoxTools up to VFP6) and use strict comparison. Still, if you have a field named UPPER or DTOC or something like that, you may find it involved in a tag where it actually wasn't.

IMO, it would be much easier to use some of the table/DBC documenting tools and check it visually.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform