on 2018 Jul 05 9:33 AM
Hi Experts,
My scenario is to sort the values in Input Q based on a numerical value below are the details.
Input Q has below list of values.
Sequence field has below list of values.
Now the fields from the input Q should be aligned as per the sequence number.
like in total of 5 contexts:
1st context with no value, 2nd context with name2, 3rd context with name6 & name3, 4th context with name4, 5th context with name5 like shown below
Please help in UDF code for this logic.
Hi Yeswanth,
All the time for the input Q will come the below values only?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yeswanth,
try below logic.
Sequence field as input1 and Input Q as input2
public void calculate(String[] var1, ResultList result, String[] var2, Container container) throws StreamTransformationException{
int c = 0;
for (int i = 0,k = 0;i<var1.length;i++)
{
c = Integer.parseInt(var1[i]);
for (int j = c; j >= 0;j--)
{
if (j == 0)
result.addContextChange();
else
{
result.addValue(var2[k]);
k=k+1;
} } }}
User | Count |
---|---|
79 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.