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 E=NoExistForIs5 has the value 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 Row caption
  • &2 Column or property caption
  • &3 Column or property value
  • &4 Row caption
  • &5 Column or property caption
  • &6 Column or property value
  • &7 Column or property caption
  • &8 Column or property value
  • &9 Column or property caption
  • &A Column or property value
  • &B Column or property caption
  • &C Column or property value
  • &D Column or property caption
  • &E Column or property value

An example of a call for this message looks 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 action 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].

Related topics