General information
Category:
Coding, syntax & commands
>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)?
findval =
xtype = TYPE('findval')
SELECT mtable
GO TOP
SCAN
FOR i = 1 TO FCOUNT()
cfield = FIELD(i)
fieldval = EVALUATE(cfield)
IF TYPE('fieldval') = xtype
*-- check the value
IF !ISNULL(fieldval)
*-- assume we don't want a null value
IF fieldval == findval
ldone = .T.
EXIT
ENDIF
ENDIF
ENDIF
ENDFOR
IF ldone
? cfield
? fieldval
EXIT
ENDIF
ENDSCAN
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only