X

The Integration blog covers the latest in product updates, best practices, customer stories, and more.

How to define a Repeating Global Variable

Jorge Herreria
Software Developer 5.

Summary

This blog addresses the following use case:  "In my OIC Orchestration, when I define a Global variable based on a repeating element (aka unbounded), the global variable is not repeating; I cannot add/append to it"

The nutshell solution:

Choose the parent element when defining the global variable

 

Details 

Why the variable is not repeating?

Because of XML Rules: When a global variable is defined, internally it is defining a reference to a XML Document. Any XML Document must have a single instance root element; in other words it cannot be a collection of root elements, even if they have the same element name.

How Do I Solve my requirement?

When defining the Variable, choose the parent element of the unbounded element (repeating). That way the  XML Document root element will be the parent element, and one of its children will be the unbounded element

To reference the variable use the location path (xpath) to the unbounded element.

Example

Defining vErrors with the intent to use errorDetails repeating element

Defining the Variable

 


Now to reference on expressions, just select errorDetails of $vErrors

Referencing the variable


Are global variables set by reference or by value?

By value.

A global variable is initialized empty when the orchestration is executed. Then when values get assigned/appended, the values get cloned from the source into the global variable; in other words, the global variable gets its own copy of the values.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.