$msgdst
Return the name of the component instance to which a message was addressed.
$msgdst
Example: putmess "%%$msgdst has received a message."
Return Values
String containing the name of the form to which the message was addressed (the destination for the message)
In addition, $msgid returns a nonempty string. If the receiveMessage trigger was not activated by postmessage, $msgid returns an empty string ("").
Use
Allowed only in the receiveMessage trigger of components.
Allowed in all component types except self-contained Report and Services.
Message Handling
The following example shows the receiveMessage trigger for an application. The example assumes that MSG_HANDLER is an instance of a service which contains operations for processing asynchronous messages. It also assumes that MSG_HANDLER has already been created (probably in the apStart trigger as the application started).
trigger receiveMessage if ( $result = "message" ) putmess "%%$msgdst received from %%$msgsrc" putmess " message id =%%$msgid" putmess " message text=%%$msgdata" if ( $msgid != "Ack") postmessage $msgsrc, "Ack", "Acknowledging message %%$msgid" else if ( $msgid = "A" ) activate "MSG_HANDLER".A ($msgdata) if ( $msgid = "B" ) activate "MSG_HANDLER".B ($msgdata) ... endif else if ( $result = "Close" ) activate "MSG_HANDLER".CLOSE if ( $result = "Timeout" ) activate "MSG_HANDLER".TIMEOUT else putmess "%%$instancename received unexpected async message: %%$result" endif end; receiveMessage