repoisition-to-row() problem

Posted by James Palmer on 13-Apr-2016 08:08

Progress 10.2B08

I feel really silly asking this to be honest! I'm trying to solve a problem with some legacy code. It's trawling through a browse and doing some stuff with the data. It does a reposition-to-row(). This works great, until the row selected is outside the usual view of the browse. After that it just selects the last row in the view rather than the actual row it should be selecting. 

I hope I've explained that well enough. 

Does anyone know how I can get the code to select a row that's not in the actual viewable range? I'm sure it's something I've done before. 

Posted by James Palmer on 18-Apr-2016 06:25

So I've found the solution. The bottom row of the browse was slightly chopped off. I increased the height of the widget marginally and it's working fine. What a crazy solution!

All Replies

Posted by carl.williams on 13-Apr-2016 08:27

Is the browser connected to an ADM2 SDO? If so you could reposition in the SDO using functions like findRowWhere & fetchRowIdent  

Posted by James Palmer on 13-Apr-2016 08:31

I think it's just ADM1 actually. But I can't make it too specific as it's generic code that drops the content of a browse out to excel.

Posted by tbergman on 13-Apr-2016 13:44

Perhaps you’re looking for reposition-to-rowid()?
 
This repositions the query, and when the query is associated with a browse should move the record into view as well
 
Tom
 

Posted by James Palmer on 13-Apr-2016 16:20

Thanks Tom. I've been trying to work out how to use that solution, but the issue is that the browse in question has columns in it that are based on variables, and not database buffers. Therefore a reposition to rowid will not necessarily find the correct record. In this browse I think it will, but there are other browses where it won't.

Posted by Lieven De Foor on 14-Apr-2016 04:32

If it is not a preselect query, then the num-results is not reliable, unless you have scrolled all the way to the end of the browse at least once. That's probably why giving any row that is higher than the current num-results (while you haven't scrolled to the end yet) ends up with the currently last row in the view...

Posted by Adriano Correa on 15-Apr-2016 04:16

Try it it is the same problem

knowledgebase.progress.com/.../000067370

Posted by James Palmer on 18-Apr-2016 06:25

So I've found the solution. The bottom row of the browse was slightly chopped off. I increased the height of the widget marginally and it's working fine. What a crazy solution!

Posted by Lieven De Foor on 18-Apr-2016 06:58

Use the following trick to ensure a browse always shows whole rows...

BROWSE myBrowse:DOWN = BROWSE myBrowse:DOWN.

Posted by James Palmer on 18-Apr-2016 07:04

Thanks Lieven. Can I also use the same trick in an external .p using the browse's handle?

Posted by Lieven De Foor on 18-Apr-2016 07:32

I guess so (haven't tried...)

This thread is closed