on 02-19-2010 1:47 PM
Hello Guys,
I have some doubts to do the some code with a UDF.
I do a call to an RFC to get some data of R/3 from PI. In the return I have:
<item>
<field1>
<field2>
</item>
The item is 0 to unbounded, and I have to do a loop at the item and take the values of field1 and field2 of the last item.
I have created a UDF with context queue, but how can I take the values
It is correct if I have?
public void calculate(String[] var1, ResultList result, Container container) throws StreamTransformationException
{
String a = "";
String b = "";
String result = "";
for ( int i = 0; i < var1.length; i++ )
{
a = var1.??
b = var1.??
}
if ( a.equals( '' ) and b.equals( 'DELE' ) )
{
result = a.
}
else
{
result = "";
}
result.addValue ( result)
}
I want to take the values of the las item for field1 and field2 in strings a and b, and after do a check of the values to put the result.
What I don't know hot to do is to take these values.
Could you help me please?
Many thanks in advance.
Regards,
Xavi.
Use removeContext just after the RFC lookup result & before the UDF. That would give you all the field values( field1 & field2) values in one context. Then use this UDF:
for(i=0;i<var1.length;i++)
{
if(i = var1.length - 1)
{
result.addValue(var1<i> ) ;
}
}
Use this same UDF for both the fields seperately.
Hope it helps.
Regards
Soumen...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have the field1 and field2 with no contexts as inputs to your UDF. Check the length of any queue (assumed to be same for both field1 and field2). Now use this length to represent the last item of the fields like field1[length-1] and field2[length-1] length. You would have last values in them. Use them where you want based on your logic.
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
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.