on 05-21-2007 10:56 AM
Hi,
I have a mapping problem: i have a source structure that contains many orders containing many LineItem. I have to count each LineItem of an order and to restart my counter for each order. Example:
<Orders>
<Order>
<Item> I1 </Item> 1
<Item> I2 </Item> 2
<Item> I3 </Item> 3
</Orders>
<Order>
<Item> I1 </Item> 1
<Item> I2 </Item> 2
<Item> I3 </Item> 3
</Orders>
</Orders>
How can I reset my counter for every Order change? I need of a detailed solution description.
Thanks to all!
Hi Gabriele,
use UDF type Context
http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm
and it will reset your counter per one order
so in your case:
<Orders>
<Order>
<Item> I1 </Item> 1
<Item> I2 </Item> 2
<Item> I3 </Item> 3
</Orders>
<Order>
<Item> I1 </Item> 1
<Item> I2 </Item> 2
<Item> I3 </Item> 3
</Orders>
</Orders>
your userr defined function (UDF) will be executed twice
once per each context and this will be what you need
Regards,
michal
-
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi;
As per the solution if you have 3 items in first order 2 in second and 4 in third than the code input to the UDF will look like
3
2
4
the first for will run 3 times as there are 3 elements(orders) in the queue.
Next for loop will add numbers to the result list based on the number of item nodes in each order.
Mudit
Award Points to motivate me further to reply
Hi ;
Mapping
Item --- Count --- Remove Context --- UDF --- Field
UDF
Input --- Value Context level function
for(int i=0;i<Value.length;i++)
{
for(int j=0;j<Integer.parseInt(Value<i>);j++)
{
result.addValue((j1)"");
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
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.