Scenario F: Updating the value of a message element
Before you start:
Create the appropriate message model, either by using the tooling or by
importing the message structure files (for example, C header or XML Schema
Definition files).
Create a message flow that has the following structure:
MQInput > Mapping node > MQOutput
This scenario demonstrates how to update the value of a message
element. The message model used in this example is:
simple (message)
int (xsd:int)
str (xsd:str)
Switch to the Broker Application Development
perspective.
Right-click the Mapping node and
click Open Map.
Accept the default project and name and click Next.
Accept the default usage and click Next.
Clear the Based on records in a database check
box and click Next.
Select the source message simple and the target
message simple and click Finish.
In the connection pane, open the source and target trees by clicking
the addition (+) icons.
Open the simple trees on both sides in the same
way.
Select int in the Message Mapping
editor Source pane,
and drag it onto int in the Target pane. A
line joins them.
Select str in the Message Mapping
editor Source pane and
drag it onto str in the Target pane. A
line joins them.
In the Map Script | Value table, open the tree by clicking the $target
+ box
Open the simple tree in the same way; both int and str have
values (for example, int $source/simple/int str $source/simple/str.
Select the value for int. The
value appears in the Expression Editing pane.
Edit the value so that it is: $source/simple/int + 1 and
press Enter. The value in the table
is updated (this increments the input value).
Select the value for str and edit it so that it
is: esql:upper($source/simple/str), and press Enter. The value in the table is updated (this converts the input value
to upper case).
Save the mapping by clicking File > Save.
You have completed this scenario. The input and output messages have
the same structure and format, but the element values have been modified.