on 06-05-2012 6:01 AM
Source Structure | Target Structure |
---|---|
<A> <B> <Y/> <X/> <X/> </B> </A> | <A> <B> <Y/> <X/> </B> </A> <A> <B> <X/> </B> </A> |
Transformation rules
The multi-mapping is working well, but how to evaluate the position of the element "Y"?. Please someone suggest to me, any idea
P.S.
I checked the nexts blogs:
http://www.saptechnical.com/Tutorials/XI/NodeFunctions/Page1.htm
http://scn.sap.com/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
http://scn.sap.com/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-part-ii
Thanks in advance for your attention
Hi Jose,
In general, it is difficult to evaluate the sequence of nodes in graphical mapping. Moreover, the solution to your problem depends on how the source structure is built in case more than one Y nodes exist. Would you explain a bit more in this area? Do the tags come like: YXXYXYXXX and so on, or rather only one Y node per each B node, etc.
Regards,
Greg
P.S. Please avoid double-posting the same question (http://scn.sap.com/thread/3186848). It makes getting the solution more difficult, both: for you and for those who want to help you, since the discussion is divided into two threads and lots of important information is missing in each of them. Please delete the redundant thread.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Grzegorz.
The node "Y" in the source structure, can exist several times or none. I need to relate a node "X" with a node "Y", only if the node "Y" is the immediate superior node "X".
Examples of the source structure.
Source structure 1
<A>
<B>
<X/>
<Y'/>
<X'/>
</B>
</A>
Expected target structure 1
<A>
<B>
<Y'/>
<X'/>
</B>
</A>
---------------------------------------------
<A>
<B>
<X/>
</B>
</A>
Source structure 2
<A>
<B>
<Y''/>
<X''/>
<Y'/>
<X'/>
</B>
</A>
Expected target structure 2
<A>
<B>
<Y''/>
<X''/>
</B>
</A>
---------------------------------------------
<A>
<B>
<Y'/>
<X'/>
</B>
</A>
Source structure 3
<A>
<B>
<X''/>
<X'/>
</B>
</A>
Expected target structure 3
<A>
<B>
<X'/>
</B>
</A>
---------------------------------------------
<A>
<B>
<X''/>
</B>
</A>
Thanks in advance
Dear Jose,
I partially agree with Baskar: this task could be difficult with only graphical mapping. But I also understand that starting over with Java mapping now that you have most part of your solution ready isn't really the desired solution . So I have an alternative for you. Use the following UDF to generate the Y node in the target structure:
String nodeX = "<X>";
String nodeY = "<Y>";
int nodeXpos = 0, nodeYpos = 0;
do {
nodeXpos = input.indexOf(nodeX);
nodeYpos = input.indexOf(nodeY);
System.out.println(input + " / " + nodeXpos + ", " + nodeYpos);
if (nodeXpos > nodeYpos && nodeYpos >= 0){
result.addValue("");
result.addValue(ResultList.CC);
}
else {
result.addValue(ResultList.CC);
}
input = input.substring(nodeXpos + 1);
} while (input.indexOf(nodeX) > 0);
The important thing is to set the Execution Type = All Values of Queue/Context (although we will always have only one input) because we need to generate an output list. Also notice that you work on a string, not DOM tree for XML, which makes it much easier, quicker and far less resource-consuming.
Then map as follows:
A(return as XML) -> UDF -> Y
Regards,
Greg
User | Count |
---|---|
93 | |
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.