8 18 PTYROUTINE

LANSA Technical

8.18 PTYROUTINE

The PTYROUTINE command is used create a routine to manipulate the value of a user-defined property.

When you define a property for a form using the DEFINE_PTY command, you can use the PTYROUTINE command to specify routines for setting the value of the property and for returning its value. You do this when you want to manipulate the value of the property. For instance you can:

  • Split the value that has been passed to the property and assign the resulting values to two or more fields. For example you could do this by splitting the value of an Address property into separate fields for street name and number, city, state and country and postcode.
  • Concatenate the values of several fields to form the value of a property when it is retrieved.
  • Calculate or otherwise derive the value of the property.

The input and output values for a property routine are defined using the DEFINE_MAP command. For more information refer to the description of 8.6 DEFINE_MAP in this chapter.

It is worth noting that the custom-defined properties (DEFINE_PTY) and the property routines are all contained inside the form. As a result the form can receive property values from its owner forms as well as return them, but the way this value is handled inside the form is not visible to the owner forms. As a consequence, you can change the way the form handles the property value without having to make any change to forms that use this property.

For instance a form which has an Address property could be changed so that post code and state information which was previously handled as one field would now be handled as two fields. As a result the property routine in the form would have to be changed, but no change would be required in other forms that set or retrieve the value of the Address property because the property itself does not change.

The name of a PTYROUTINE can be the value of the SET or GET parameters in a DEFINE_PTY command. See the description of 8.7 DEFINE_PTY.

Also See

8.18.1 PTYROUTINE Parameters

8.6.4 DEFINE_MAP in PTYROUTINE

8.10 ENDROUTINE

 

                                                           Required       

                                                                          

    PTYROUTINE ---- NAME -------Routine Name -------|