How to Call User-Defined System Messages

Previous Next

See Also

You can call the messages that you have defined for your application using the MessageLanguage() application method.


There are four more application methods which can be used to display messages: MessageInformation(), MessageError(), MessageWarning(), and MessageQuestion(). However, the message text for these methods need to be hard-coded in the parameter list, and are not called from .smg files. Please refer to the USoft Developer Reference Help for the details of these methods. User-defined messages for which translations are required must be called with the MessageLanguage() application method. (See the section "Translation Mechanism of System Messages").

The general syntax of the MessageLanguage() application method is:

MessageLanguage(<category>,<message name>, <type> [,<yes-action>, <no-action>] [,<value1>, <value2>...])

where "type" can be INFORMATION, ERROR, WARNING, or QUESTION. If you choose QUESTION, you must provide a Yes Action, and a No Action. (These indicate what is to happen when the end-user clicks the Yes, or No button on the message dialog that appears.)

Suppose you have a message called "my_message_1" in the category "nice messages". This message takes two parameters: <param1>, and <param2>. The text of the message is "Hello <param1> of the <param2> department".

To have the message displayed as an information message, for example, you could use:

MessageLanguage('nice messages', 'my_message_1', 'INFORMATION',

'John', 'Finance')

Two message parameters ("John" and "Finance") are hard-coded in this example.

If the MessageLanguage() application method is embedded in a decision, you can use ":1", ":2" etc. as parameters to refer to the output columns of the SQL statement. For example:

· Decision SQL

SELECT    e.emp_name, d.dept_name

FROM    emp e, dept d


· Yes Action

MessageLanguage('nice messages', 'my_message_1', 'INFORMATION',:1,:2)

· No Action