$msgdata
Return the message data received from postmessage.
$msgdata
Example: putmess " message text=%%$msgdata"
Return Values
Data that was sent with a postmessage statement. The returned value has the same data type as the data that was sent.
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