Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
Have a field with set of numbers with a delimiter >> ex: (1.4, 5.1, 5.35, 2.4)
Expected result after sort by descending - (5.35, 5.1, 2.4, 1.4)
Is there standard function to apply sort within a field
Thanks,
Umashankar
For example:
T_Start:
LOAD * Inline
[
ID| Field
1| (1.4, 5.1, 5.35, 2.4)
2| (0.8, 3.1, 2.35, 6.4)
] delimiter is ('|');
Result:
LOAD
ID,
'(' & Concat(Token, ', ', -Token) & ')' as Result // -Token will sort the tokens in descending order
Group by ID;
LOAD
ID,
Num(SubField(PurgeChar(Field, '()'), ',')) as Token //subfield will return one row per token
Resident T_Start;
Something like this
LOAD
ID,
'(' & Concat(Token, ',', -Token) & ')' as Result // -Token will sort the tokens in descending order
Group by ID;
LOAD
ID,
SubField(PurgeChar(Field, '()'), ',') as Token //subfield will return one row per token
FROM ....
ID shows how other fields should be handled. The Group By in the upper load should contain all fields except Token.
For example:
T_Start:
LOAD * Inline
[
ID| Field
1| (1.4, 5.1, 5.35, 2.4)
2| (0.8, 3.1, 2.35, 6.4)
] delimiter is ('|');
Result:
LOAD
ID,
'(' & Concat(Token, ', ', -Token) & ')' as Result // -Token will sort the tokens in descending order
Group by ID;
LOAD
ID,
Num(SubField(PurgeChar(Field, '()'), ',')) as Token //subfield will return one row per token
Resident T_Start;
Thanks Jon