>>I'd like to process all the tables of a VFP database, looking for column names that contain certain strings. Does an open database expose any collection properties/attributes? It would be nice to be able to do something like this:
>>
>>OPEN DATABASE MyDBC
>>
>>FOR EACH {table} IN MyDBC
>> ...
>>
>
>Check adbObjects() function.
OK, so no collection properties, ADBOBJECTS() is the best thing available.
Code for those interested:
CLEAR
CLOSE DATABASES ALL
OPEN DATABASE dat\data
lnTableCount = ADBOBJECTS( laTables, "TABLE" )
FOR lnIx1 = 1 TO lnTableCount STEP 1
lcTable = laTables[ lnIx1 ]
USE ( lcTable )
lnFieldCount = AFIELDS( laFields )
FOR lnIx2 = 1 TO lnFieldCount STEP 1
lcFieldName = UPPER( laFields[ lnIx2, 1 ] )
IF "REQUESTKEY" $ lcFieldName OR "REQFK" $ lcFieldName OR "RQFK" $ lcFieldName
? lcTable + "." + lcFieldName
ENDIF
ENDFOR
USE
ENDFOR
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up