Skip to Content
avatar image
Former Member

Mapping User defined function

Dear experts,

the following funktion has 3 inputs an one output. It shall forward input 3 if input 2 is found in input 1.

public void take3IfFound2In1(String[] a, String[] b, String[] c, ResultList result, Container container) throws StreamTransformationException{

for ( int i = 0; i <  a.length; i++ )
{
	if(a<i>.equals(b[0])) {
       result.addValue(c<i>);
   }
	else {
       result.addSuppress();
   }
}
}

So far it is working, but I am not able to put a CopyValue behind. Why not? I need the output undefined times. Please help.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jun 09, 2010 at 03:19 PM

    Copy Value works based on the index value of the input field. It can not dynamically repeat the values with changing index. You have to enhance the UDF itself by adding anothe input fields which determines how you want to repeat the input values.

    VJ

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2010 at 07:29 AM

    Dear Vijaya,

    thanks for your response. Unfortunately, I can't check this anymore but I am sure I will need it again. Please tell me how you would implement your idea?

    To add one more input is not that difficult but what shall happen inside the function? Sorry about my stupid questions - I am quite unfamiliar with this stuff.

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 16, 2010 at 08:06 AM

    Hello,

    The boolean function ifWithoutElse function would almost do the same thing as the UDF you've written since you are comparing the contents of array a to a constant b[0] and then outputting the contents of c[]. Since it is not possible to use copyValue for suppressed values, you can try this approach:

    1. Use spaces first

    2. Do your copy value

    3. Suppress the spaces using another UDF

    Hope this helps,

    Add comment
    10|10000 characters needed characters exceeded