cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping User defined function

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

VijayKonam
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

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,

Former Member
0 Kudos

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.