Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following code in Form B defines the property and specifies that its value is set using a property routine called SET_EMP_NAME and returned by a property routine called GET_EMP_NAME.

...

   define_pty name(EMP_NAME) set(SET_EMP_NAME) get(GET_EMP_NAME)
Define Input Parameter

FormB contains this SET_EMP_NAME routine:

...

   ptyroutine name(SET_EMP_NAME)

...


define_map *input class(#fullname) name(#this_emp)

...


*  <<logic to split #this_emp to #GIVENAME and #SURNAME>>

...


endroutine

The DEFINE_MAP statement in this routine specifies that the EMP_NAME property can take a value which is valid for a #FULLNAME field and that the value is identified by the name #this_emp inside this routine.  

An owner form can now set the value of  the EMP_NAME property in Form B.

...

   set #FORMB EMP_NAME(#fullname)

or

...

   set #FORMB EMP_NAME('John Smith')
Define Output Parameter

FormB also contains the GET_EMP_NAME routine which returns the value of the EMP_NAME property:

...

   ptyroutine name(GET_EMP_NAME)

...


  define_map *output class(#fullname) name(#this_emp)

...


*  <<logic to concatenate #GIVENAME and #SURNAME to form #this_emp>>

...


endroutine

The DEFINE_MAP statement in this routine specifies that the EMP_NAME property will return a valid value for #FULLNAME field. The output value is referred to with the name #this_emp. The routine then concatenates the values of #GIVENAME and #SURNAME to form the value #this_emp which will be returned as the value of the EMP_NAME property.

An owner form can now query the value of EMP_NAME for example like this:

...

   IF COND(#FormB.Emp_Name *eq 'John Smith')