on 05-26-2011 8:26 AM
hi all,
i have a problem regarding contexts.
for example i have an input:
A
B
C
context change
D
E
context change
F
context change
G
H
I
if i do collapsecontext, the output would be
A
D
F
G
but in my case, the output should be the last value of per context:
C
E
F
I
is this possible without using UDF?
Thanks all!
Hello,
You can use sort:lexicographical case insensitive descending before your collapseContext.
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.
try this with a udf.
mapping:
source>reverse>collapse context-->target
UDF:
execution type:All Values of context
public void reverse(String[] var1, ResultList result, Container container) throws StreamTransformationException
{
int l=var1.length;
int i=0;
while(i<l)
{
result.addValue(var1[l-i-1]);
i++;
}
}
Thanks,
Anand
Hi,
Try in message mapping.
Source --> sort (descending) --> CollapseContext ---> Target
Regards,
P.Rajesh
Edited by: Rajesh_1113 on May 26, 2011 1:25 PM
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 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.