Progress
ADM 2 Guide


Dynamic Properties

Dynamic properties are object properties that are defined on an as-needed basis. Two functions, setUserProperty and getUserProperty, support dynamic properties in SmartObjects. They allow you to define dynamic properties without using either the set and get functions or a temp–table FIELD.

The setUserProperty function sets a named property. It is defined in an application as follows:

setUserProperty RETURNS LOGICAL
  ( pcPropName AS CHARACTER, pcPropValue AS CHARACTER ) : 

The getUserProperty function returns the value of a specified property that was previously set using the setUserProperty function. The getUserProperty function is defined as follows:

getUserProperty RETURNS CHARACTER
  ( pcPropName AS CHARACTER ) : 

Note that because the property values managed by getUserProperty and setUserProperty are stored as part of the ADM–DATA procedure attribute for the SmartObject, they are always stored and returned as CHARACTER strings.

This example illustrates how to set up a dynamic property called NewLimit. It assumes that you have a SmartDataViewer, and a SmartWindow that contains a button that sets a NewLimit attribute in the SmartDataViewer. To set up the NewLimit dynamic property, follow these steps:

  1. Add the following to the SmartWindow button trigger code, to set the property:
  2. DYNAMIC-FUNCTION(’setUserProperty’:U IN h_v-customer,
      INPUT "NewLimit",
      INPUT dNewLimit:SCREEN-VALUE). 
    

  3. Add the following code to the SmartDataViewer, to get the property:
  4. DECIMAL(DYNAMIC-FUNCTION(’getUserProperty’:U,
      INPUT "NewLimit")). 
    


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095