Kbase P84127: ADM1: How to select a set of rows in a multiple-selection SmartDataBrowse?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  09/08/2004 |
|
Status: Unverified
GOAL:
How to select a set of rows in a multiple-selection ADM1 SmartDataBrowse?
FACT(s) (Environment):
Windows
FACT(s) (Environment):
Progress 8.x
FIX:
Assume a SmartDataBrowse instance named 'bCust.w' against the Customer table of the sports database:
1. Edit 'bCust.w' by right clicking on it and choosing 'edit master' or opening it seperately in the AppBuilder or UIB.
2. Using the section editor, create an internal procedure for 'bCust.w' and call it somthing like 'selectMyRows'.
3. Insert (cut and paste) the following code in 'selectMyRows' procedure:
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
DEFINE VARIABLE rRowid AS ROWID NO-UNDO.
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
DEFINE VARIABLE iNumResults AS INTEGER NO-UNDO.
OPEN QUERY br_table PRESELECT EACH Customer NO-LOCK.
ASSIGN
iNumResults = NUM-RESULTS('{&BROWSE-NAME}').
DO iCount = 1 TO iNumResults:
REPOSITION {&BROWSE-NAME} TO ROW(iCount).
BROWSE {&BROWSE-NAME}:SELECT-FOCUSED-ROW() NO-ERROR.
IF balance < 25000 THEN
BROWSE {&BROWSE-NAME}:DESELECT-FOCUSED-ROW() NO-ERROR.
REPOSITION {&BROWSE-NAME} TO ROW(1).
END.
END PROCEDURE.
4. Now whenever you need to select these rows, you execute the 4GL statement:
RUN selectMyRows IN h_bcust.
5. The above code may easily be adapted to take a parameter or more that would carry specifications of the rows we need selected.