Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, December 31, 2008

ResultList Object in XI Message Mappings

Use

This object is used in advanced user-defined functions to return the result of the function. If you save the entire queue before the call in the user-defined function, use this object to either return a queue or to return the context of a queue.

Features

Methods of the Container Object

Method

Use

void addValue(String value);

Appends a value to the results list

void addContextChange();

Appends a context change to the list. This can also be achieved if you append the constant ResultList.CC by using addValue().

void addSuppress();

Appends the constant ResultList.SUPPRESS to the list. The generation of the target field and its sub nodes is suppressed for such entries.

void clear();

Deletes all previously appended values from the list.

You can use the ResultList.CC constant to find context changes in the input array that the function was transferred to, for example:

a[index].equals(ResultList.CC)

The following context changes are always available implicitly and are not part of the input array.

· If you only import one context into an input array before you call advanced functions, then the array only contains values and no context change.

· If you import an entire queue into an input array before you call the advanced functions, then there is no context change at the start and the end of the array.

Example

This example shows the use of ResultList.SUPPRESS, in that the standard function createIf() is programmed as an advanced user-defined function. This standard function also works internally with the SUPPRESS constant:

· If you specify true, an empty string is created for the field to be generated

· If you specify false, createIf() creates the constant ResultList.SUPPRESS

If you implement this function as an advanced user-defined function, you just need to import a constant from myCreateIf() prior to the call. The function has the following source text:

public void myCreateIf(String[] a,
ResultList result,
Container container)
{

for ( int i = 0; i < a.length; i++ )
{
if( a[i].equals("true"))
result.addValue( “” );

else
result.addSuppress();
}

}

No comments: