Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
In my application all the charts for sorting am using the below approach, where I have to sort values of a chart in following order
‘Others’ should be in the last always.
What I have done here is I have assigned each and every column with a rank no and in sorting properties used conditional sorting for “only(rank)”.
LOAD * INLINE [
LOC CODE, RANK
CLD, 1
CTC, 2
ODD, 3
SDC, 4
Plant, 5
Other, 6
];
But this is causing more inline tables getting created inTable Viewer. whether this is correct way to perform this sorting or is there any other better way. Sorting is to be implemented in almost every chart in my application,So please help me this....
Regards,
Anil
Oops...!! I`m not sure, whether i understood your problem correctly or not. you are comfortable to write pages and pages of if condition when you have 100 to 1000 code but not comfortable to create a inline table .
Do have any rules to create a sort order? if so.. share us the rules for sorting order, will try to create the dynamic solution.
Hope i`m clear.
-Sridhar
Vijay now its working perfectly....i have changed a bit in the exp like this
If([LOC CODE] ='CLD', 1,(If( [LOC CODE] ='CTC', 2,(If( [LOC CODE] ='ODD', 3,(If( [LOC CODE] ='SDC', 4,(If( [LOC CODE] ='Plant',5,(If( [LOC CODE] ='Other',6)))))))))))
Sridhar i confused a bit with your answer but it is working from you way also
i think above exp is the easy to use for sorting what do you say guys.........
Guys thanx for all your replies and suggestions.......
Regards,
Anil
Do the inline load at the top of the script, leave the RANK field out of it, and then drop the table at the end of the script. Then you can sort by original load sequence. I do that all the time.
[Location Sort Order]:
LOAD * INLINE [
LOC CODE
CLD
CTC
ODD
SDC
Plant
Other
];
// rest of your script here
DROP TABLE [Location Sort Order];
You'll have to reload to change the sort order, which might be a drawback, but it's then easy to use that same sort order everywhere. If you really want a chart expression for some reason, the match() function returns the sequence number of the first match, so this should work as the sort expression.
match([LOC CODE],'CLD','CTC','ODD','SDC','Plant','Other')