Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, December 31, 2008

Advanced User-Defined Functions in XI Message Mappings

Use

Advanced user-defined functions can access more than just individual field values. Instead, you can import a complete context or an entire queue for a field as an array before your function is called. This enables you, for example, to perform calculations on all field values of a context as well as to divide up the contexts themselves further by inserting context changes.

Integration

When the instance for a source structure is parsed, a message mapping works with queues.

This graphic is explained in the accompanying text

There is a queue for each hierarchy level. A queue can have the following entries:

Possible Queue Entries

Value

Meaning

(empty string)

This is a queue for a structure field. In the queue there is an entry with an empty string each time the field appears in the XML instance. In the example above there is such a queue for and .

(string)

Value of a value field

ResultList.CC

Constant that shows a context change

ResultList.SUPPRESS

Constant that causes a field and its subnode to be ignored during processing

(empty context)

Context that does not contain any values (see the graphic below).

You can create special structure mappings by adding or removing context changes. The standard functions SplitByValue and removeContexts() work by this principle.

See also: Structure Mappings by Setting the Context.

The following basic rule applies for nested structures: The number of contexts of a queue must be the same as the number of values (empty strings) of the upper-level queue.

This graphic is explained in the accompanying text

Features

Advanced user-defined functions can import either just one context into the input arrays, or complete queues. Make your selection by selecting or deselecting the Cache Entire Queue checkbox in the function editor.

Working with Contexts or Queues

Information in Cache

Implications

Context

Advanced functions that only import one context do not have an identifiable context change. You can of course insert a context change into the results list.

Queue

Since one or more entire queues are imported in this case, this option is more memory-intensive and is not suitable for very large messages.

The input arrays do not contain the context change at the start and end of the context (or the queue). These context changes are implicitly always available and cannot be identified or deleted from the user-defined function.

Activities

...

1. Create an advanced user-defined function (see User-Defined Functions).

2. Process the values from the input arrays in the Java source text and create a results list by using the ResultList object.

No comments: