How to select certain rows in a browse widget after the brow

Posted by ashon shakya on 24-Jan-2017 01:38

When loading a browse widget, I need a way to select certain rows automatically. 

example:
I have a browse h-browse

if i use h-browse:SELECT-ROW(1) it will select the first row displayed in the browse similary i need to select multiple non serial rows. Can be row 1 ,5,7 ,etc. I need to select certain rows that may be visible in the viewport or outside as well. 


Posted by Torben on 24-Jan-2017 03:40

Try using a combination of:

hQUERY:REPOSITION-TO-ROW( n).

hBROWSER:SELECT-FOCUSED-ROW( ).

All Replies

Posted by Torben on 24-Jan-2017 03:40

Try using a combination of:

hQUERY:REPOSITION-TO-ROW( n).

hBROWSER:SELECT-FOCUSED-ROW( ).

Posted by maura on 24-Jan-2017 08:08

If you specify  browse with the MULTIPLE option, you can call SELECT-ROW()  multiple times and those rows will remain selected.

Posted by maura on 24-Jan-2017 08:12

But that will only work for rows in the viewport

Posted by Adriano Correa on 25-Jan-2017 05:52

This may help

DEF BUTTON bt1 LABEL "show".

DEF VAR v-trans AS LOGICAL NO-UNDO.

DEF TEMP-TABLE ttt NO-UNDO

        FIELD xxx AS INT.

CREATE ttt. ASSIGN xxx = 1.

CREATE ttt. ASSIGN xxx = 2.

CREATE ttt. ASSIGN xxx = 3.

CREATE ttt. ASSIGN xxx = 4.

CREATE ttt. ASSIGN xxx = 5.

DEF QUERY q1 FOR ttt.

DEFINE BROWSE br1 QUERY q1

      DISPLAY xxx

 WITH 5 DOWN SEPARATORS SIZE 50 BY 6 MULTIPLE.

DISP br1 bt1 WITH FRAME f1.

ON 'choose':U OF bt1

DO:

   FIND ttt WHERE xxx = 2.

   REPOSITION q1 TO RECID RECID(ttt).

   ASSIGN v-trans = br1:SELECT-FOCUSED-ROW().

   FIND ttt WHERE xxx = 4.

   REPOSITION q1 TO RECID RECID(ttt).

   ASSIGN v-trans = br1:SELECT-FOCUSED-ROW().

   RETURN.

END.

ENABLE ALL WITH FRAME f1.

OPEN QUERY q1 FOR EACH ttt NO-LOCK.

WAIT-FOR CLOSE OF THIS-PROCEDURE.

Posted by ashon shakya on 25-Jan-2017 23:56

Close but i used reposition-to-rowid(rowid).

This thread is closed