Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to search a table for a value and return fieldname
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00193342
Message ID:
00193348
Views:
14
>>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
sorry. To search the table:

locate for somevalue $eval(field(i))
if !eof()

etc...
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform