8.4.3 Method Results

Methods can have one of their *OUTPUT maps defined as *RESULT. In this way you can use a method in an expression as a function call that produces a factor of an expression.

For example:

Mthroutine Name(MakeMessage)
Define_Map For(*RESULT) Class(#STD_TEXT) Name(#OutTextOne)
Define_Map For(*INPUT) Class(#STD_TEXT) Name(#InTextOne)
Define_Map For(*INPUT) Class(#STD_TEXT) Name(#InTextTwo)
#OutTextOne := #InTextOne.Value + " " + #InTextTwo.Value
Endroutine

Evtroutine Handling(#PHBN_2.Click)
Begincheck
Datecheck Field(#STD_DATE) In_Format(*DDMMYY)
Endcheck Msgtxt(#COM_OWNER.MakeMessage( "#Phbn_2.Click", "Bad Date" ))
Endroutine

Methods or intrinsic functions that return a Boolean result can be used in IF statements.  This is similar in concept to the use of a defined condition (see DEF_COND command).  However, because a method is being invoked, there are no limitations imposed upon the nature of the condition.

Mthroutine Name(Set_availability)

#Button1.Enabled := #COM_OWNER.Allow_Access
#SURNAME.readonly := *Not #COM_OWNER.Allow_Access

Endroutine

Mthroutine Name(Allow_Access)
Define_Map For(*RESULT) Class(#Prim_boln) Name(#RESULT)

#RESULT := True

If (#GIVENAME.Contains( 'ABC' ))
#RESULT := False
Endif

Endroutine