Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
You could create a mapping table with all values by adding a order information part delimited by a arbitrary delimiter not part of your key values ('|' in my sample). Then you can address first, second, etc mapping value per key:
MAP:
MAPPING
LOAD A&'|'&AutoNumber(Recno(),A) as A, B
INLINE
[
A B
1 A
1 B
2 C
3 D
3 E
4 F
] (delimiter is '\t');
LOAD A,
Applymap('MAP', A&'|2', ApplyMap('MAP',A&'|1')) as Test
INLINE
[
A
1
2
3
4
];
suppose your original table is called T
then do the following:
T2:
mapping
load Column1, FirstSortedValue(Column2,-Column2)
resident T
group by Column1;
drop table T;
hope this helps
You could create a mapping table with all values by adding a order information part delimited by a arbitrary delimiter not part of your key values ('|' in my sample). Then you can address first, second, etc mapping value per key:
MAP:
MAPPING
LOAD A&'|'&AutoNumber(Recno(),A) as A, B
INLINE
[
A B
1 A
1 B
2 C
3 D
3 E
4 F
] (delimiter is '\t');
LOAD A,
Applymap('MAP', A&'|2', ApplyMap('MAP',A&'|1')) as Test
INLINE
[
A
1
2
3
4
];
It's because you are coy-pasting it and '\t' is not working properly in that case. Try using different (comma) separator like:
MAP:
MAPPING
LOAD A&'|'&AutoNumber(Recno(),A) as A, B
INLINE
[
A, B
1, A
1, B
2, C
3, D
3, E
4, F
];
LOAD A,
Applymap('MAP', A&'|2', ApplyMap('MAP',A&'|1')) as Test
INLINE
[
A
1
2
3
4
];
There are no tab characters between column headers and field values. Either replace the spaces with a tab character, or change this
(delimiter is '\t');
to this
(delimiter is ' ');
from the sample data you supplied you can take the max group by first column and do the mapping table
Hi,
maybe this
MapTable:
Mapping
LOAD A,LastValue(B) as B Inline [
A, B
1, A
1, B
2, C
3, D
3, E
4, F]
Group By A;
LOAD DISTINCT A,ApplyMap('MapTable',A) as B Inline [
A, C
1, 12
1, 23
2, 34
3, 45
3, 56
4, 67];
Regards,
Antonio