Consultor Eletrônico



Kbase P12343: How to retrieve values of a selected row in a SmartDataBrows
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/08/2003
Status: Unverified

GOAL:

How to retrieve values of a selected row in a SmartDataBrowse and store them

FACT(s) (Environment):

Progress 9.1x

FIX:

To retrieve values of a selected row in a SmartDataBrowse and store these for use within the application perform the following:

Create a SmartWindow, place on this a SmartDataBrowse, SmartDataObject a Buttons.

Within the trigger of button 1 places the following:

DO:
DEFINE VARIABLE cValues  AS CHARACTER  NO-UNDO.
DEFINE VARIABLE cColumns AS CHARACTER  NO-UNDO.
DEFINE VARIABLE i        AS INTEGER    NO-UNDO.

cColumns = DYNAMIC-FUNCTION('getDisplayedFields':U IN h_bcust).
/* cColumns contains ALL the fields on the browser in a comma
  separated list.  If you do not want all the columns, cColumns
  should contain a comma separated list of the columns you want
  example : cColumns = "Name,City"
  Name & City MUST be valid Columns on the browse             */


ASSIGN cValues = DYNAMIC-FUNCTION('colValues':U IN h_dcust,
    INPUT cColumns).
/* DYNAMIC-FUNCTION('colValues') returns the values of the columns
  passed in the list cColumns from the SDO                    */


/* We now loop through the number of entries within cColumns and
  create a property prefixed with the letter p, example :
  pName and Pcity and set these within the SMO, these can then
  be called from other SMO's or assigned to variables for use */

i = 1.
DO WHILE i <= NUM-ENTRIES(cColumns):
  DYNAMIC-FUNCTION('setUserProperty':U,
                  INPUT "p" + ENTRY(i,cColumns),
                  INPUT ENTRY(i + 1, cValues,CHR(1))).
  i = i + 1.
END.

END.