on 03-21-2006 11:47 AM
Hi All,
I am now doing multi-mapping like this:
Source A:
<A>
<A1>
<A2>a</A2>
<A3>b</A3>
</A1>
<A1>
<A2>c</A2>
<A3>d</A3>
</A1>
<A1>
<A2>e</A2>
<A3>f</A3>
</A1>
</A>
Source B:
<B>
<B1>
<B2>e</B2>
<B3>x</B3>
</B1>
<B1>
<B2>a</B2>
<B3>y</B3>
</B1>
</B>
Target C's structure is the same as A.
What I want to do is: If the value of A2 equals the one value of B2s, mapping B2,B3 to C2,C3; else maping A2,A3 to C2,C3, like this:
<C>
<C1>
<C2>a</C2>
<C3>y</C3>
</C1>
<C1>
<C2>c</C2>
<C3>d</C3>
</C1>
<C1>
<C2>e</C2>
<C3>x</C3>
</C1>
</C>
What's more, all the B2 value set belongs to A2 value set.
Is it possible? Any comment or suggestion is grateful!
Regards,
Nick
Hi
You have to create a UDF (context):
>>If the value of A2 equals the one value of B2s,
I suppose any one value of B2
<u>Input</u>
A2(Context A)
B2(Context B)
public void createTarget(String[] A2,String[] B2,ResultList result,Container container){
int j=0, flag=0,k=0;
for (k=0;k<A2.length;k++)
{
for (j=0;j<B2.length;j++)
{
if (A2[k].equals(B2[j]))
{
flag=1;
result.addValue(""+B2[j]);
}
}
if (flag == 0) result.addValue(""+A2[k]);
flag=0;
}
}
A2(context A)|-- createTarget -- Splitbyvalue -- C2
B2(context B)|--
Same goes for C3 (with all values in terms of 3).. You can use the same UDF.
Regards
Suraj
Message was edited by: S.R.Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suraj,
When b2 is equal a2, you take b2, otherwise a2.
You can always take a2
Here is my example for c3 (already tested):
public void myFunction(String[] a2,String[] b2,String[] a3,String[] b3,ResultList result,Container container){
for (int k=0;k<a2.length;k++)
if(a2[k].equals(ResultList.CC))
result.addContextChange();
else{
boolean found = false;
String resultValue = a3[k];
for(int l=0;l<b2.length;l++)
if(a2[k].equals(b2[l])){
resultValue = b3[l];
break;
}
result.addValue(resultValue);
}
}
Regards
Stefan
Hi,
>>Same goes for C3 (with all values in terms of 3).. You can use the same UDF.
I think the same UDF can't be used:
You have to change the above UDF slightly
<b>public void createC3(String[] A2,String[] B2,String[] A3,String[] B3,ResultList result,Container container){
int j=0, flag=0,k=0;
for (k=0;k<A2.length;k++)
{
for (j=0;j<B2.length;j++)
{
if (A2[k].equals(B2[j]))
{
flag=1;
<i>result.addValue(""+B3[j]);</i>
}
}
if (flag == 0)
<i>result.addValue(""+A3[k]);</i>
flag=0;
}
}</b>
A2(Context A) |
B2(Context B) |---- createC3---Splitbyvalue --- C3
A3(Context A) |
B3(Context B) |
Regards
Suraj
A1--->C1
A2----
...........then...\
A2-----\
-
|>StringEquals>if..............|-->c2
B2------/
B2----
...........ELSE...../
A3----
...........then...\
A2-----\
-
|>StringEquals>if..............|-->c3
B2------/
B3----
...........ELSE...../
Regards,
KNS Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nick,
You can do this easily using the standard functions....to know how to implement the same....pls go through this link:
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
Pls see this link which explains a similar scenario with a screen shot.
http://help.sap.com/saphelp_nw04/helpdata/en/5d/db0e83e8e74202a5bff527055ab7e5/content.htm
Regards,
abhy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nick,
When I understood the correct, then you want:
C2 = A2
C3 = (if A2 exists in B2: B3 else A3)
You can do this easily with a user defined function where you have A2, A3, B2 and B3 as input parameters and cache the whole queue. The result list of this function should look like follows:
y
ContextChange
d
ContextChange
X
Check out this blog for testing user defined functions in an Java environment:
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
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.