Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to sort the below column from -ve to +ve. Attaching the sample file. Please suggest.
| -0 to -50 |
| 0 to 1,000 |
| 20,001 to 40,000 |
| 5,001 to 10,000 |
| 1,001 to 5,000 |
| -51 to -100 |
| No change |
| -100 to -200 |
| 10,001 to 20,000 |
| -501 to -1,000 |
| -201 to -500 |
| 40,000 to 60,000 |
| 60,001 + |
| -1,001 + |
As below
Load Grouping,new_grouping,recno() as rown, Coalesce(subfield(new_grouping,'to',2),trim(new_grouping),0) as sort_order
;
Load Grouping, trim(replace(replace(replace(Grouping,'+',''),',',''),'No change',0)) as new_grouping
inline [
Grouping
"-0 to -50"
"0 to 1,000"
"20,001 to 40,000"
"5,001 to 10,000"
"1,001 to 5,000"
"-51 to -100"
"No change"
"-100 to -200"
"10,001 to 20,000"
"-501 to -1,000"
"-201 to -500"
"40,000 to 60,000"
"60,001 +"
"-1,001 +"
];
exit Script;
Then use the sort_order field as Sort By Expression
=Max(sort_order)
As below
Load Grouping,new_grouping,recno() as rown, Coalesce(subfield(new_grouping,'to',2),trim(new_grouping),0) as sort_order
;
Load Grouping, trim(replace(replace(replace(Grouping,'+',''),',',''),'No change',0)) as new_grouping
inline [
Grouping
"-0 to -50"
"0 to 1,000"
"20,001 to 40,000"
"5,001 to 10,000"
"1,001 to 5,000"
"-51 to -100"
"No change"
"-100 to -200"
"10,001 to 20,000"
"-501 to -1,000"
"-201 to -500"
"40,000 to 60,000"
"60,001 +"
"-1,001 +"
];
exit Script;
Then use the sort_order field as Sort By Expression
=Max(sort_order)