Skip to Content
avatar image
Former Member

User Defined Function Issue with Inbound Node

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 19, 2010 at 08:00 PM

    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...

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 19, 2010 at 07:44 PM

    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

    Add comment
    10|10000 characters needed characters exceeded