on 08-09-2007 5:21 PM
All,
I will simplify the issue we have and explain.
We have the following structure. (the occurence <data> node is unbounded)
<source>
<data>...</data>
<data>...</data>
<data>...</data>
</source>
we need to split this into another message <source2> with the exact same structure... but we need only 10 <data> nodes in the <source2>. In this <source2> the <data> node is of max occurs 10.
so if we get a <source> message with 1000 <data> nodes comes in, we need to split it into 100 <source2> messages.
How can we do this? (due to constraints we cannot use the file content conversion)
Thanks.
Hi,
We can do it easily. Create UDF , in UDF take all the values in Queues. Run the loop, for every 10 counts add the values in the queue, then change the context,
I hope this will solve ur issue:
for(int i=0;i<Input_Values.length;i++)
{
if(i%10 ==0 and i ! =0)
result.addContextChange();
else
result.addValue(""Input_Values<i>"");
}
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Raj,
And how will this UDF be used in the mapping? (i mean between which nodes.)
Here are the sample source and target structure. (for the sake of explaining easily - i will show the split for every 2 <data> nodes.
<source>
<data><name>j</name><desc>some desc</desc></data>
<data><name>j2</name><desc>some desc2</desc></data>
<data><name>j3</name><desc>some desc3</desc></data>
<data><name>j4</name><desc>some desc4</desc></data>
</source>
<sourceIdx>
<data><index>1</index><name>j</name><desc>some desc</desc></data>
<data><index>2</index><name>j2</name><desc>some desc2</desc></data>
</sourceIdx>
<sourceIdx>
<data><index>3</index><name>j3</name><desc>some desc3</desc></data>
<data><index>4</index><name>j4</name><desc>some desc4</desc></data>
</sourceIdx>
Thanks!
Hello,
Please check whether the below logic suits your scenario.
Change Messages - http://flickr.com/photo_zoom.gne?id=1064675286&size=o
Mapping -http://flickr.com/photo_zoom.gne?id=1064675070&size=o
Mapping -http://flickr.com/photo_zoom.gne?id=1064675164&size=o
UDF's- http://flickr.com/photo_zoom.gne?id=1064675480&size=o
Results http://flickr.com/photo_zoom.gne?id=1064675320&size=o (Source 4 Data)
Results http://flickr.com/photo_zoom.gne?id=1064675430&size=o (Source 5 Data)
The above example will split source data into 2 messages each.
If it doesn't helps, let me know.
Best regards,
raj.
Thanks Harsha. The support from you guys make me to learn more!!! The solution which i'm suggesting might be to tedious inspite of easier solution avaiable. Anyhow I'll try to crack the easiest way and suggest the solutions henceforth.
Thanks for the support and encouragement!!!
Best regards,
raj.
thezone, are you trying to split the root element of this? If you are, you will need to use a bpm.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The only way I can think of doing that is to create a context User Defined Function which takes in all data elements, which will come in as an array, and then create the output which will have a context change after each group of 10.
Here's a basic outline:
for (int ind = 0; ind < a.length; ind++)
{
if (ind % 10 == 0)
result.addValue(ResultList.CC);
result.addValue(a[ind]);
}
Yaghya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are your adapters in this scenario?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.