Constructing application messages
A message can be constructed so that values of various parameters can be picked up and used dynamically when the message is invoked. This is done with the use of substitution parameters that are evaluated when the message is invoked and run-time values substituted for the parameters.
These substitution parameters are indicated in a message by the use of an ampersand (&), followed by a number or letter; for example &5 and &C.
These are possible sources of values for substitution parameters:
- Row captions
- Column or property captions
- Column or property values (literal or variable)
- Column or property value-captions (that is, the translatable caption that appears in the drop-down list of one or more combo box components on a form)
When you construct a message with substitution parameters, make sure the code that invokes the message contains the correct number of values for the substitutions.
To invoke the message at run-time, insert an expression into your code at the point where you want to call the message. This expression must use the MESSAGE parameter function.
For example, the message code E=NoExistForIs5 displays this message (in English): "There exists no &1 where &2 is &3 for &4 that has [&5: &6] and [&7: &8] and [&9: &A] and [&B: &C] and [&D: &E]."
This message requires these parameters:
- &1 = The row caption
- &2 = The column or property caption
- &3 = The column or property value
- &4 = The row caption
- &5 = The column or property caption
- &6 = The column or property value
- &7 = The column or property caption
- &8 = The column or property value
- &9 = The column or property caption
- &A = The column or property value
- &B = The column or property caption
- &C = The column or property value
- &D = The column or property caption
- &E = The column or property value
An example of a call for this message might look like this:
MESSAGE("E=NoExistforIs5", "@serial", "@serial.ser_num", V(SerNum) , "@item" , "@serial.whse", V(Whse) , "@serial.item", V(Item) , "@serial.loc", V(Loc) , "@serial.lot", V(Lot) , "@rsvd_inv.import_doc_id", V(ImportDocId) )
At run-time execution time, this example might evaluate to this string:
There exists no Serial Number where S/N is S/N1234 for Item that has [Whse: MAIN] and [Item: BK-27000-0007] and [Location: STOCK] and [Lot: LOT00012345] and [Import Doc Id: DocId000123456].