on 10-29-2009 5:25 AM
Hi All,
my requirement is below:-
UDF should have 2 inputs.
input 1 has 10 values
abcdf
jasbb
sjkancjn'
jksncj'
dbdchja
jahsbcb
djsbcb
shjscbb
jhcajbb
ahjcbhasbc
2nd input has value like
2
3
3
2
Now my requirement is to produce outut as below...
abcdf
jasbb
**context change**
sjkancjn'
jksncj'
dbdchja
**context change**
jahsbcb
djsbcb
shjscbb
**context change**
jhcajbb
ahjcbhasbc
Can anyone please help me
Hi,
Try this:
inputa = values with abcd etc
input b = numerical values
Create a UDF for queue and give inputa and inputb as inputs to the UDF.
inputa > removecontext->UDF
inputb > removecontext->
int k=0;
for (int i=0;i<inputb.length;i++) {
for (int j=0;j<Integer.parseInt(inputb<i>);i++) {
result.addValue(inputa[k]);
k++;
}
result.addContextChange();
}
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can also try this :
int countold = 0;
int countnew = 0;
int k = 0;
for(int i =0;i<var1.length;i++)
{
countold = countnew + 1;
countnew = countnew + Integer.parseInt(var1<i>);
for( int j = countold-1 ;j<countnew;j++)
{
result.addValue(var2[k]);
k++;
}
result.addContextChange();
}
Regards,
Ganesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.