on 03-31-2011 11:05 PM
Hi All,
I have this source structure:
<sourceItem> (1..unbounded)
<sourcevalue1> (1..1)
<sourcevalue2> (1..1)
Both sourcevalues are inside sourceItem.
Target structure is as this:
<targetItem> (1..unbounded)
<targetvalue1> (1..1)
<targetnode> (1..unbounded)
<targetvalue2> (1..1)
Targetvalue1 is inside targetItem and targetnode is at same level as targetvalue1. Targetvalue2 is inside targetnode.
Logic for creation of targetItem (which is done and working as in thread ) is for example:
The sourcefields got values 1, 2, 2, 2 and 3.
Then, targetfield is created for each nonrepeteable sourcefield value, in this case it need to be created 3 times.
What I don't know if PI mapping can do this without UDF, is:
1) targetvalue1 need to get corresponding value of targetItem.
2) targetnode need to be created as many repeats of targetvalue1.
3) targetvalue2 need to have each value of corresponding context of sourcevalue2.
If it was not clear, let me give you an example. When this source example is mapped:
<sourceItem>
<sourcevalue1>1</sourcevalue1>
<sourcevalue2>A</sourcevalue2>
</sourceItem>
<sourceItem>
<sourcevalue1>2</sourcevalue1>
<sourcevalue2>B</sourcevalue2>
</sourceItem>
<sourceItem>
<sourcevalue1>2</sourcevalue1>
<sourcevalue2>C</sourcevalue2>
</sourceItem>
<sourceItem>
<sourcevalue1>2</sourcevalue1>
<sourcevalue2>D</sourcevalue2>
</sourceItem>
<sourceItem>
<sourcevalue1>3</sourcevalue1>
<sourcevalue2>E</sourcevalue2>
</sourceItem>
we need to get this target example:
<targetItem>
<targetvalue1>1</targetvalue1>
<targetnode>
<targetvalue2>A</targetvalue2>
</targetnode>
</targetItem>
<targetItem>
<targetvalue1>2</targetvalue1>
<targetnode>
<targetvalue2>B</targetvalue2>
</targetnode>
<targetnode>
<targetvalue2>C</targetvalue2>
</targetnode>
<targetnode>
<targetvalue2>D</targetvalue2>
</targetnode>
</targetItem>
<targetItem>
<targetvalue1>3</targetvalue1>
<targetnode>
<targetvalue2>E</targetvalue2>
</targetnode>
</targetItem>
And I can't find a way to do it.
The only thing is now done is the correct creation of the targetItem.
Any genious knows how can this be solved?
Thanks in advice!
Regards.
Hello,
This mapping assumes that the values are already sorted (e.g no 1 3 2 inputs) in your source message.
For targetItem
sourcevalue1 -> removeContext -> splitByValue:valueChange -> collapseContext -> targetItem
For targetvalue1
sourcevalue1 -> removeContext -> splitByValue:valueChange -> collapseContext -> splitByValue:eachValue -> targetvalue1
For targetnode
sourcevalue1 -> removeContext -> splitByValue:valueChange -> targetnode
For targetvalue2
sourcevalue2 -> targetvalue2
If the values from your source are not sorted, you need to use sort and sortByKey, but the logic will be almost the same as above.
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mark's reply was the solution to all my issues.
Thanks all for your help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
PLease check the below mapping i have tried
1 . Sourcevalue1-removecontext-splitbyvalue(valuechange)-collapsecontext-removecontext-Targetitem
2 . Sourcevalue1-removecontext-splitbyvalue(valuechange)-collapsecontext-splitbyvalue(eachvalue)-Targetitem
3 .Sourcevalue1 u2013 remove context -
SortbyKey -
Sourcevalue2 u2013 remove context-------
FormatByExample -
TargetNode
Sourcevalue1 u2013 remove context u2013splitByValue----
4. Sourcevalue1 u2013 remove context -
SortbyKey -
TargetValue2
Sourcevalue2 u2013 remove context-----
I am not sure till what extent you can understand ..because i am not able to put the screen shot. If u want i can send to ur mail id
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try the follwoing.
sourceitem - > target item
sourcevale1 - > targevalue1
empty constant -> targetnode
sourcevalue2 - > targetvalue2.
Regards,
Sreenivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.