User GuideReference ManualIntegration Scenarios
 

2.1.7. Metadata

See: Managing Channels - Basic Channel Functions

Metadata is information about other data such as file name, channel or environment ID, mail addresses... that can be used as data to customize system outputs.

Metadata is useful to customize your own system output such as output file name and e-mail subject or body text.

All system metadata lists hereunder can be used when necessary.

Changing value assigned to a system metadata in drag and drop transformation

In drag and drop transformation you can use and route metadata linked to incoming message such as Input File Name, Input User... On the other hand, you can also add your own metadata in the Message Definition Out pane and map any node to this metadata. To add such a metadata, right click on User defined metadata and choose Add in the contextual menu.

This new metadata will then be available in following processing steps, for example it can be used in email notification body text as illustrated hereunder.

Drag and drop transformation with metadata

Figure 2.7. Drag and drop transformation with metadata


Using metadata to customize messages and file names

You can use system or user defined metadata in your output gateways and email notification configuration. The metadata values can be used to name output files sent through output gateways. or as part of a notification email subject and or body. The metadata used may even be different for success or failure messages as shown in following figures.

System metatada are referenced using syntaxt {com_babelway_messaging_context_***}. A list of available system metadata with returned variables and examples is available in System Metadata appendix.

System metadata used to customize notification emails

Figure 2.8. System metadata used to customize notification emails


System metadata used to customize file names

Figure 2.9. System metadata used to customize file names


User defined metatada are referenced using syntaxt {user-defined-property:your_metadata} where your_metadata is the name of your user defined metadata you want to reference as illustrated in the following example where the earlier user defined metadata is used as a name for the file sent as email attachment.

User defined metadata used to customize attachment name

Figure 2.10. User defined metadata used to customize attachment name


Concatenate values from a loop in a metadata

If you want to concatenate multiples values from a loop in a single metadata such as a message reference or a user defined metadata, you have 2 options:

1. Use a full custom xpath:

  • Do not map any loop.

  • Create a Xpath custom expression such as:

string-join (YOUR_XPATH, 'YOUR_SEPARATOR')

Where YOUR_XPATH is the path to all the element you want to concat such as:

/ediroot/interchange/group/transaction/loop/segment[@Id='NAD' and element[@Id='NAD01'] = 'BY']/element[@Id='NAD02']/subelement[@Sequence='1']

or

/csv/line/field1

Or drag a repeated element (such as the line hereover) on the custom function. All field1 elements under the repeated element will be concatenated and separated by the given separator.

$arg1/field1

YOUR_SEPARATOR is the separator between two elements of the list such as ' - ' for example.

2. Use the functions get-metadata and set-metadata

  • Map the loops to the output metadata

  • Create a Xpath custom expression with the following expression:

    metadata-util:put($MSG,'com_babelway_messaging_context_message_reference', bfn:concat('YOUR_PREFIX', 'YOUR_SEPARATOR', 'YOUR_SUFFIX', metadata-util:get($MSG,'com_babelway_messaging_context_message_reference'), $arg1))

    Where

    • YOUR_PREFIX is the prefix added at the beginning of the result, ex: ' here is the list of value: '

    • YOUR_SEPARATOR is the separator added between the different elements, ex: ' '

    • YOUR_SUFFIX is the suffix added at the end of the result ex: [i ' '[/i]

  • Drop the value of the element to the expression (= $arg1 )

  • Map the expression to the metadata