Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looping through field names
Message
From
02/07/2007 19:10:40
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
02/07/2007 15:55:34
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01237070
Message ID:
01237277
Views:
28
>>>Hi. I have a DBF with one record (simple enough). How would I refer to the field names if I were looping through them (looking for any with a value).
>>
>>To paraphrase Terry. No macro sub required.
>
>Just can't resist:
>
>
>For I = 1 to FCOUNT()
>  lcField = forceext(ALIAS(), FIELD(m.I))
>  If not EMPTY(eval(m.lcField))
>      ....
>  Endif
>EndFor
>
Interesting. I wouldn't have thought of using force extension to make the field the extension of the alias. How about this:


m.lcAlias = ALIAS() + "."
For I = 1 to FCOUNT()
If not EMPTY(eval(m.lcAlias + FIELD(m.I)))
....
Endif
EndFor
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform