cancel
Showing results for 
Search instead for 
Did you mean: 

UDF requirement

santosh_k3
Active Participant
0 Kudos

Hi All,

please help me on this logic , as i am not good at java

tried for the logic but not able to generate exact result.

Here is the requirement:

when ever there is a space in the input queue i need to pass the value which is before space i.e., here 3,6,7 are the values that

exists before space and pass it to the spaced values

here in input queue you see that after 3 value there are two spaces so i need to pass two 3 values in the spaced values

and after six there are two spaces then we need to pass two 6 values in the spaced values

and at last after 7 there is one space and i need to pass one 7 value and so on..

Suppose i have the values in the input Queue as

input Queue

1

2

3

5

6

7

8

my requirement is to generate the result as

Ouput Queue as

1

2

3

3

3

5

6

6

6

7

7

8

please help me on this.

Thanks

Sai

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Use this UDF:

Input = var1

Execution type: all values of a context

String a = "";

for(int i=0;i<var1.length;i++)

{

if(!var1[i].equals(""))

{

result.addValue(var1[i]);

a = var1[i];

}

else

result.addValue(a);

}

Thanks

Amit Srivastava

Answers (0)