X

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

Conditional Mappings in Oracle Integration

Thomas Hora
Senior Director of Development

Sometimes, when modeling integrations, we need to map data dynamically depending on other data.   In this blog, we will look at creating conditional mappings using Oracle Integration.

Use case:

Consider this pseudo code sample of the mapping logic. How can we achieve this in the mapper UI?

if PER03 == 'TE' {
    Contact.Phone = PER04
}
if PER05 == 'TE' {
    Contact.Phone = PER06
}
if PER07 == 'TE' {
    Contact.Phone = PER08
}

Solution:

First, enable “Advanced” mode and open the Components palette.  This exposes XSLT statements which we need to create conditional mappings.

 

 

Locate the phone element in the target tree.  This is the element where we want conditional mappings.  If phone is a lighter color and italicized, that means the element does not yet exist in the mapper’s output. Right click and select Create Target Node.  We will not be able to insert conditions around phone without this step.

Drag and drop the choose element as a child of phone.  The cursor position surrounding phone indicates whether choose will be inserted as a child (bottom left) or as a parent (upper right).  In this case, we will insert as a child.

 

 

Now that we have choose in the tree, drag and drop when as a child of choose 3 times to create placeholders for our 3 conditions.  Note, you could also drop a when statement as a sibling before or as a sibling after another when.

Each condition also needs a corresponding mapping value.  Drag and drop value-of as a child of each when.  Now we have the tree structure needed to create our conditional expressions and mapping expressions.

 

 

Let’s create the expressions for the first condition and mapping.

if PER03 == 'TE' {
    Contact.Phone = PER04
}

To create the condition, select the first when in the target tree.  Drag and drop PER03 from the source tree into the expression builder.  Complete the expression by typing = “TE” and click the checkmark to save the expression.

To create the mapping, select the value-of under the first when.  Drag and drop PER04 into the target value-of.

The first conditional mapping is complete.  Repeat these steps for the remaining second and third conditional mappings to achieve the desired logic. Save the map and integration.

if PER05 == 'TE' {
    Contact.Phone = PER06
}
if PER07 == 'TE' {
    Contact.Phone = PER08
}

The finished product will look like this.

Congratulations! We have just used Oracle Integration to create conditional mappings.

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.