on 05-10-2010 2:16 PM
Hi!
Can you help me with a Java function.
I want to check if a field exists or not. If it exists then I want to produce an Idoc in the target structure and if it doesn't exist then no Idoc should be produced.
I have "Value of Context" in my UDF and my code looks like this:
for(int i=0;i<PartCode.length;i++)
if (ObjectA<i>.equals("1") && ObjectB.length >= 1)
{
result.addValue(e<i>);
}
else
{
result.addSuppress();
}
Everything works beside the .length function. The Idoc is populated even if ObjectB doesn't exist
Edited by: Sonny Chaos on May 10, 2010 3:18 PM
Try this:
for(int i=0;i<PartCode.length;i++)
if (ObjectA.equals("1") && ObjectB.length >= 1)
{
if !(ObjectB.equals(ResultList.SUPPRESS))
{
if !(ObjectB.equals(ResultList.CC))
{
result.addValue(e);
}
}
}
else
{
result.addSuppress();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you try length() instead of length?
Regards,
ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
WHy do you need a UDF for this?
You can use the Exists function isn't it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
why cant you use the standard node function EXISTS for your requirement?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I know but the actual Code is very long and there are more conditions that I didn't mention here. the Graphical Mapping would be very long and complicated.
And by the way, When I tried to do the Graphical Mapping I got another error. When the field ObjectA occurs 2 times in the same segment then I get a mapping error. it is 1-Outbounded so it should occur several times if necessary but when I use the function EXIST then I get an error that I should check if the mapping is correct.
Hi Sony,
Looks the problem is your target IDOC root level struccture should be 0..1 (so that when condition shatisfied you can create the target else you can suppress) by default 1..1 occurance you have to change of occurance export the IDOC xsd and modify and re-import the IDOC.
Assume your source structre
T1
-> Object A
-> Object A
Above two times apperaed what you can do
ObjectA->CopyValue(0)->chech kength -> and greated then zerp produce empty node so that you can create the target IDOC node.that mean you are populating the IDOC.
Do not write any UTF..try all the standard UDF... Before that first check your occurance are correct.
I mean now you want based on conditon need to create the IDOC in that case target schema should be 0..1 or 0..unbound if it'segment level you want to check..
Regards,
Venu.
User | Count |
---|---|
84 | |
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.