Question Find by rowid without table

If I have a rowid but don't know the table it relates to, is there any way to locate the record and then identify the table?

Other than doing this:
def var bh as handle.
def var fnd as logi.
def var rwid as rowid.

rwid = <a valid rowid>.

for each _file no-lock where not _hidden:

create buffer bh for table _file._file-name.
fnd = bh:FIND-BY-ROWID(rwid),NO-LOCK).
if fnd then
do:
message 'found' string(rwid) 'in table' _file._file-name.
leave.
end.
end.
 
Last edited:

Rob Fitzpatrick

ProgressTalk.com Sponsor
If I have a rowid but don't know the table it relates to, is there any way to locate the record and then identify the table?

Other than doing this:
def var bh as handle.
def var fnd as logi.
def var rwid as rowid.

rwid = <a valid rowid>.

for each _file no-lock where not _hidden:

create buffer bh for table _file._file-name.
fnd = bh:FIND-BY-ROWID(rwid),NO-LOCK).
if fnd then
do:
message 'found' string(rwid) 'in table' _file._file-name.
leave.
end.
end.

I don't understand how you end up with a rowid without knowing where it came from. Why are you storing it in a variable if you don't know which table it is in?

Also, your logic assumes that the first matching rowid is the "right" one. There is no reason for that to be necessarily true.
 
Top