on 03-24-2010 9:39 AM
Hi,
I have a source node that contacts the following.
"1234-5678".
When there is a "-" in the source node then I need to create two target nodes.
When there is no "-" in the source node then only create one node.
Since the source structure is a flat structure by on the target side as you can see I am trying to achieve a diep structure.
Please can you assist in how to do this with PI message mapping.
Regards
Willie Hugo
Goto Message Mapping.
Pick that node & use Duplicate Subtree.
Now you have 2 target nodes.
In mapping, now create 2 UDF
First for using this code :
int i = 0;
String temp = a[0].toString();
i = temp.indexOf('-');
result.addValue(temp.substring(0,i));
Second for using this code:
int i = 0;
String temp = a[0].toString();
int l = temp.length();
i = temp.indexOf('-');
result.addValue(temp.substring(i,l-1));
Now map Source using First UDF with First Target
& using Second UDF with Second Target.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank all for your input. The duplicate sub tree function just escaped me as a solution there. Also true that UDF is required for variable substring functions, but that was not really my problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
"1234-5678" only occurs once in the source. There is no source xml node that will occur more that once. The whole structure only occurs once. But on the target side I need one of the node to occur more than once if a hyphen is found in the source field.
Source Message - Always only one data node.
==============
<root>
<OnceOnlyNode>1234-5678</OnceOnlyNode> [1..1]
</root>
Target Message - Only two text node when "-" in source, else only one text node.
=============
<msg>
<text>1234</text>
<text>6789</text>
</msg>
How can this be done using standard PI message mapping functions. Can it be done?
Regards
Willie Hugo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
its a simple logic.
Use CreateIf and use indexOf function to help you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Willem,
>>When there is a "-" in the source node then I need to create two target nodes.
Since in this example (which you provided) you have two values differentiated by a hyphen , you wan to have two target nodes. So what about this:
abcd-efgh-123
is it three target nodes? If yes then you need to write a udf which will read the input value and do a split on -. The resultant values will be placed in the output queue, using result.addValue();
Also make sure the output node have a max occurs of n or unbounded.
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try using CreateIf standard function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.