on 06-18-2012 4:41 AM
Hi,
We have two inputs to the UDF, one will have a numeric value such as 2,3 etc. and we need to create this no. of contexts for the second input. For example if the first input is 3, we need to create 3 contexts for the second input.It is similar to UseoneasMany, except that instead of creating contexts based on the no. of times a value appears, we need to create contexts based on a numeric value.Pls note that the same value of second input will be created as many times as the numeric value in first input.
Hello,
You can use this UDF:
type:contextType
arguments: inp1, inp2
for(int a=0;a<inp1.length;a++){
int temp = Integer.parseInt(inp1[a]);
for(int b=0;b<temp;b++){
result.addValue(inp2[a]);
}
}
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adarsh,
Use the below function:
When you are defining the parameters define input1 variable as int input2 as String ( and define as Queue)
for(int i=0;i<input1[0]-1;i++)
{
result.addValue(input2[0]);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.