$putmess

Send a message to the message frame, or return the contents of the message frame.

$putmess = String

vReturn = $putmess

Example: putmess = "Action succeeded"

Parameters

Parameters
Parameter Data Type Description

String

String

String containing the message content, or a null string ("").
  • If String is assigned, the message frame is cleared and set to contain the contents of String.
  • If a null string is assigned, the message frame is cleared.
  • If omitted, the message frame is not cleared.

Return Values

  • Contents of the message frame.
  • Empty string (""), if the message frame has been cleared.

Use

Allowed in all component types except self-contained Report and Services.

Description

What you can do with the contents of the message frame depends on the environment of the running component, for example:

  • In a component running locally, you can use $putmess output as you see fit
  • In a remote component (such as a service running in a Uniface Server), the Uniface Server will redirect the contents of the component's message frame to the server's logfile. For more information, see $PUTMESS_LOG_FILE.

    This is not the case for a Uniface Server acting as a Database Server or File Server. These return server messages back to the client.

  • You can also return $putmess to the client as an OUT parameter from a remote component, as shown in the example.

Using $putmess in Static Server Pages

In a Static Server Page, $putmess inserts the content of the message frame into the generated HTML page. This is done by specifying the function type in the <X_SUBST> tag in the following way:

<PRE><X-SUBST type=function name=$putmess> </X-SUBST></PRE>

In a web application, $putmess also contains trace information from the debug statement, if specified in the application.

Assigning Message Frame Contents to Variable

The following example, from a component running locally, assigns the content of the message frame to the global variable RETRIEVEDETAILS.

trigger retrieve
retrieve
if ($status < 0)
  message $text(1762) ;error
endif
$$RETRIEVEDETAILS = $putmess

Returning Message Frame Contents as a Parameter

The following example, from a service component running remotely, assigns the content of the message frame to an output parameter for processing by the client.

operation TEST_RETRIEVE
params
   string pKey : IN
   string pPutmess : OUT
endparams
clrmess
putmess "Start of service <$componentname>"
CUST_ID/init = pKey
retrieve
if ($status < 0)
   putmess " Retrieve failed"
   putmess " $procerror = %%$procerror"
   putmess " %%$procerrorcontext"
endif
putmess "End of service <$componentname>"
pPutmess = $putmess
end

Related Topics