Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to search a table for a value and return fieldname
Message
 
 
To
02/03/1999 16:21:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00193342
Message ID:
00193346
Views:
13
>What would be a Code to search a table for a value and return the fieldname containing that value, (perhaps multiple fieldnames, perhaps multiple records)?

start with:
llFound = .f.
for i = 1 to fcount()
  if type(field(i)) = "C"
     if somevalue $eval(field(i))  && might want to use upper() on both
        llfound = .t.
        exit
     endif
  endif
next
if llFound
   return field(i)
else
   return .null.
endif
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform