Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Strange Mapping Behavior with "createif"

$
0
0

Hi everybode,

 

I have a business case where I have the following XML Structure (Example):

 

Source Structure

===============

<Customers>

<Customer>

   <ID>2</ID>

   <Name>Jim Hasselhoff</Name>

</Customer>

<Customer>

   <ID>9999</ID>

   <Name>Jack</Name>

</Customer>

</Customers>

 

 

Target Structure

===============

<CustomerTarget>

   <ID>2</ID>

   <Name>Hasselhoff</Name>

</CustomerTarget>

 

 

The Mapping is:

=============

- /Customers/Customer/ID  to  /CustomerTarget/ID.

- /Customers/Customer/Name  to  /CustomerTarget/Name.

- Condition 1) The Node "CustomerTarget" should only created if the Customer ID = 2.

- Condition 2) The Name of the CustomerTarget is only the second Name (using substring).

 

 

The Problem is:

=============

The Mapping fails, because it performs substring on Customer with ID = 9999 even though the Node will not be created afterwards.

 

Error Message:

=============

Runtime exception when processing target-field mapping...... oot message: Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range:...

 

 

 

Question:

==========

1) Why does the Mapping Engine perform substring even though the Node will not be created??

2) Is it really necessary to use ifWithoutElse before the substring to also check if the Customer ID = 2 ?? Isn't there a better solution??

 

 

Best regards,

Ben


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>