on 08-21-2009 8:25 AM
Hi Experts,
The source structure is
MT
RootNode
Parent(1..unbounded)
Contact(0..unbounded)
Phone(0..1)
Subscriber(0..)
I've to map a target node to Parent->Contact(1)->Phone->Subscriber node only and skipping all other occurences of Contact.
How do we do it in PI?
Regards,
Vishal
please explain your requirement clearly (how do you want to map)giving target structure also
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
If I understand your problem correctly, then you want to populate only 2nd number value out of suppose 10 values as an input.
You can write an UDF for it in which, just loop until the counter value is equal to 2. You can pass the output when counter = 2.
Also, you can try using copyValue function, which will pass only 2nd value.
BR,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
I've requirement as below..
Consider Contact as Parent element and Telephone as child element. I need to map in the following manner..
Contact[2].Telephone ---> Number(Target node).
If it was Telephone[2]---> Number then copyValue function would be simple.
How can it be done for my requirement?
Regards,
Vishal
For Ex:
In my input file the following data come..
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<DT>
<Contact >
<Telephone >9857468<Property>
<Description >EFGH<Description>
</Contact>
<Contact >
<Telephone >989897468<Property>
<Description >EFGH<Description>
</Contact>
</Contact>
</ns0:Message1>
</ns0:Messages>
I want only the 2nd Telephone value to be used in mapping.
>
> For Ex:
> In my input file the following data come..
> <?xml version="1.0" encoding="UTF-8"?>
> <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
> <ns0:Message1>
> <DT>
> <Contact >
> <Telephone >9857468<Property>
> <Description >EFGH<Description>
> </Contact>
> <Contact >
> <Telephone >989897468<Property>
> <Description >EFGH<Description>
> </Contact>
> </Contact>
> </ns0:Message1>
> </ns0:Messages>
>
> I want only the 2nd Telephone value to be used in mapping.
Hi Vishal,
You want ony the 2nd Telephone numer....
Did you mean to say, If you are having 5 Telephone numbers you want to use only 2nd telephone number..
Mention your requirement properly...
Thanks.
Edited by: Jyothi Anagani on Aug 21, 2009 11:58 AM
Hi Vishal,
Map like this...
Telephone(Context Chnage)--
UDF code...
int len = a.length;
if(len > 1)
{
result.addValue(a[1]);
}
else
{
result.addValue(a[0]);
}
This UDF will return the 2nd Telephone number if you are having more than 1 telephone....Otherwise it will return the same..
Thanks.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
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.