Kbase 18948: ADM2 - How To Get Selected Values From A Multi-Select Browse
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
Status: Verified
GOAL:
How to Get Selected Values from a Multi-Select Browse
FACT(s) (Environment):
Progress 9.x
FIX:
If you have a SmartDataBrowse tied to a SmartDataObject and the SmartDataBrowse has multi-select turned on for the browse widget, the following steps show you how to retrieve each of the selected rows.
You cannot directly access these rows using the RowObject temp-table in the SmartDataBrowse since the RowObject temp-table does not really contain the data.
1) Load the AppBuilder.
2) Connect to the Sports2000 database.
3) Create a new SmartDataObject against the Customer table (select all fields).
4) Create a new SmartDataBrowse and specify the SmartDataObject you
created in #3 above as the data source.
5) Double-Click the browse widget in the SmartDataBrowse and turn on the "Multiple-Selection" setting.
6) Resize the frame of the SmartDataBrowse so that you can add a button to the frame.
7) Add a button to the SmartDataBrowse's frame.
8) Put the following code into the CHOOSE trigger for the button:
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hCustNum AS HANDLE NO-UNDO.
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
ASSIGN hQuery = br_table:QUERY
hBuffer = hQuery:GET-BUFFER-HANDLE(1) /*Customer Buffer*/
hCustNum = hBuffer:BUFFER-FIELD("CustNum").
DO iCount = 1 TO br_table:NUM-SELECTED-ROWS:
br_table:FETCH-SELECTED-ROW(iCount).
MESSAGE "Customer Number"
hCustNum:BUFFER-VALUE
"Selected" VIEW-AS ALERT-BOX.
END.
9) Save the SmartDataBrowse.
10) Create a SmartWindow.
11) Add the SmartDataObject to the SmartWindow.
12) Add the SmartDataBrowse to the SmartWindow.
13) Run the SmartWindow.
14) Select several rows in the browse widget.
15) Click the button.
At this point, a message box will be displayed for each selected customer, showing you the customer number.