on 11-28-2007 11:02 AM
Hello,
I have an <b>IDOC-File</b> scenario where....
<b>SOURCE:</b>
SEGMENT1 1..N
FIELD1 1..1
CHILD1 1..N
CHILD2 1..N
<b> TARGET</b>
FIELD1 1..1
Now the situation is sum of child1 & child2 (which has occurrence 1..n) should be subtracted from field1(source) and the result is then mapped to field2(target).
I am expecting a feasible solution from you guys....
Awaiting your reply..thanks in advance
Hari
You can do that by defining a simple java function in <b>user defined</b> in the grafical mapping editor. You have just to create one. Your entries will be CHILD1 and CHILD2. You have to mark your function as a <b>queue</b>. Then you add and substract the values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Voila:
//write your code here
int child1=0;
int child2=0;
int child3=0;
int field1=0;
for ( int i = 0; i < a.length; i++ ) {
child1=child1+Integer.parseInt(a<i>);
}
for ( int i = 0; i < b.length; i++ ) {
child2=child2+Integer.parseInt(b<i>);
}
for ( int i = 0; i < c.length; i++ ) {
child3=child3+Integer.parseInt(c<i>);
}
for ( int i = 0; i < d.length; i++ ) {
field1=field1+Integer.parseInt(d<i>);
}
int s=child1+child2+child3-field1;
String s2 = String.valueOf(s);
result.addValue(s2);
Regards
Gonzalo
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.