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.
Try using a combination of:
hQUERY:REPOSITION-TO-ROW( n).
hBROWSER:SELECT-FOCUSED-ROW( ).
Try using a combination of:
hQUERY:REPOSITION-TO-ROW( n).
hBROWSER:SELECT-FOCUSED-ROW( ).
If you specify browse with the MULTIPLE option, you can call SELECT-ROW() multiple times and those rows will remain selected.
But that will only work for rows in the viewport
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.
Close but i used reposition-to-rowid(rowid).