Queryhandle:reposition-to-rowid Issue

Kalan

Member
Hi all,

I've problem when my dynamic query involved with more than one table. for ex,
lvRowid has valid rowid value,
qryhandle:IS-OPEN = TRUE
iv-qryhandle:NUM-RESULTS <> 0 also TRUE,
However I am not sure lRepos = qryhandle:REPOSITION-TO-ROWID(lvRowid) NO-ERROR. returns lRepos = false and ERROR-STATUS:ERROR = no.

When I check qryhandle:NUM-BUFFERS value its 2, then I looked into query string as its composed with one temp-table and one db table.
For ex, for each ttHeader no-lock,
each dbHeader where rowid(dbHeader) = ttHeader.Headerrowid.


I suspect since this query uses two different buffer when I use Reposition-to-rowid system unable to locate right buffer.

Could someone pls suggest generic solution on this?

Thanks.
 

TheMadDBA

Active Member
You have to supply every ROWID for the specific row... for dynamic queries you are better off using the rowid-array option and just fill the array with the proper rowids in the proper order.

Documentation has the exact syntax you need.
 

Kalan

Member
Thanks DBA, I've used "REPOSITION-TO-ROWID(lv-FileRowId)" instead of array variable, still I get an issue as its not repositioning correct record. In case of using array variable I understand your suggestion even if we dont specify every position of array then progress always looks the variable[1] position value if its blank then it does not reposition as its from documentation.
 

Kalan

Member
Also when {&file} as dbtable name ex., dbHeader statements BUFFER {&file}:handle = qryhandle{&brwsfx}:GET-BUFFER-HANDLE(1) value as FALSE
BUFFER {&file}:handle = qryhandle{&brwsfx}:GET-BUFFER-HANDLE(2) value as TRUE

Based on this scenario my "qryhandle:REPOSITION-TO-ROWID(lv-FileRowId)" should be applied on Buffer-HANDLE(2). My question here how do we specify/set current buffer handle as 2 to trigger reposition-to-rowid? - Thanks.
 

TheMadDBA

Active Member
Read my reply again... and the documentation.

You must supply a ROWID for every buffer involved in the query in order to reposition to an exact row.
 

Osborne

Active Member
As TheMadDBA posted, you require a ROWID for every buffer in the query:
Code:
qryhandle:REPOSITION-TO-ROWID(lv-FileRowId[1], lv-FileRowId[2]) NO-ERROR.
If you do not know how many buffers the query has until run then you need to do something like this:
Code:
lv-FileRowId = ?.

DO i = 1 TO qryhandle:NUM-BUFFERS:
   hBuffer = qryhandle:GET-BUFFER-HANDLE(i).
   lv-FileRowId[i] = hBuffer:ROWID.
END.
 
Last edited:

Kalan

Member
Thanks DBA and Osborne, it works fine now. The issue I found since query string is attached with temp-table and dbtable( temp-table is outerloop) I should get rowid of temp-table instead of dbtable on the above requirement context.
 
Top