on 09-14-2011 2:55 PM
Hi,
I would like a function to copy an array (my second queue) as many times as there are values in my first queue.
So for example
Queue 1
1
2
3
4
Queue2
A
B
Result
A
B
Context Change
A
B
Context Change
A
B
Context Change
A
B
Hi,
public void calculate(String[] Item, ResultList result, String[] repeat, Container container) throws StreamTransformationException{
for(int i=0;i<repeat.length;i++)
{
for(int j=0;j<Item.length;j++)
{
result.addValue(Item[j]);
}
result.addContextChange();
}
}
Input :
Queue1
A
B
Queue 2
1
2
3
4
Result
A
B
Context Change
A
B
Context Change
A
B
Context Change
A
B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use this UDF
for(int i=0;i<queue1.length;i++)
{
for(int j=0;j<queue2.length;j++)
{
result.addValue(queue2[j]);
}
result.addContextChange();
}
Regards,
Chandra Shekhar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
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.