on 09-13-2007 11:26 AM
Hi,
I have a one to one mapping of IDOC ORDERS.
I need to test if the segment E1EDPT1 never exists in the xml instance.
If it does not i want to create it.
The problem is it takes context of the superiour node.
I don't want to add it if it exists in another context.
Example where it must not add the segments :
E1EDP01 (item1)
-E1EDPT1
--E1EDPT2
E1EDP01 (item2)
(segments does not exist)
E1EDP01 (item3)
-E1EDPT1
--E1EDPT2
Example where it must add the segments :
E1EDP01 (item1)
(segments does not exist)
E1EDP01 (item2)
(segments does not exist)
E1EDP01 (item3)
(segments does not exist)
I tried with MapWithDefault which is good for the second case but not the first as it adds the segments if it can't find the segments in node E1EDP01.
Thanks,
Laurent.
When I understand right, you want to add all E1EDPT1, if none exists, but leave the queue as is, if any exists.
I think, you should do this with a UDF.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this:
public static void addValuesToContexts(String[] a, ResultList result, Container container) {
boolean found = false;
for (int k = 0; k < a.length; k++)
if (!a[k].equals(ResultList.CC))
found = true;
if (found) {
for (int k = 0; k < a.length; k++)
result.addValue(a[k]);
} else {
for (int k = 0; k < a.length; k++) {
result.addValue("");
result.addContextChange();
}
result.addValue("");
}
}
Laurent,
He means if>sourcesegment>exists-->then (do your logic) else (logic).
Or
if>sourcesegment>exists-->createif.
All depends upon your logic also.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use: exists - createif.
Then a "suppress" is added and keeps the contexts in order.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
You mean (exists - not - createif)?
I tried this but you have to add an (if else) function if the segment exists in the source otherwise it is not mapped. And this way it doesn't work in contexts neither.
My mapping looked like this :
E1EDPT2 - exists - not - <- IF
constant. (creates the segment) <- THEN
E1EDPT2 <- ELSE
This doesn't work as it checks in the same context.
I want to check in the whole xml structure, so i tried to change the context but this was not resolving my problem.
But maybe you meant something else?
Regards,
Laurent
Hi Varun,
I tested this but if source doesn't have neither E1EDPT1 and E1EDPT2
the E1EDPT2 is not created as it's one to one mapping.
When i test it on example with segments E1EDPT1 and E1EDPT2 in source structure the contexts are not good. The empty text is put in the last item.
...
Regards,
Laurent.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
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.