on 05-26-2011 6:31 AM
Hi XI Gurus,
I have a problem regarding sorting again. Is there any way I can use sort but the characters after an "_" will not be part of the sorting?
EX.
test_1.0
variable_5.5
test_0.5
variable_0.1
expected output should be
test_1.0
test_0.5
variable_5.5
variable_0.1
what's happening in my mapping is
test_0.5
test_1.0
variable_0.1
variable_5.5
w/c is very wrong when mapped to the target fields.
I tried using substring first before I sort but I get this
test_1.0
test_5.5
variable_0.5
variable_0.1
please help. much appreciated. thanks!
Hi ,
try doing this using UDF.
Regards,
Sheetal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I asked a JAVA expert to create a UDF. thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use this.
for (int i = 0; i < var1.length; i++) {
for (int j = i + 1; j < var1.length; j++) {
if ((var1[j]).compareTo(var1<i>) < 0) {
String temp = var1<i>;
var1<i> = var1[j];
var1[j] = temp;
}
}
}
return var1;
}
+++++++++++++++++++++++
May be your java expert can use this.
Edited by: Pothana Yadav on May 26, 2011 12:40 PM
hi,
use the SORT function to sort the values and then use a UDF function to change to order of the sub-text.
i really don't see any other way
regards.
roi grosfeld
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
I think if you are getting values as
test_1.0
variable_5.5
test_0.5
variable_0.1
then use standard function Sort which is available in mapping.
Functions> Node Functions> Sort
double click sort function and select (Case sensitive and ascending)
and it will give output as
test_1.0
test_0.5
variable_5.5
variable_0.1
No need to use substring and other logic.
In mapping just use standard function Sort as following
Source field > sort> Target field
Thanks,
Bhupesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.