sorting an array?

Is there any built-in function to sort an array, or even better, an associative array on the value or key? I didn’t see it in any of the docs. I’m having to use the registry to keep track of the search history since the app is specialized enough that using the global search history doesn’t make sense. Since I can only show about 9 items, I’d like to order them by the number of times they were searched for.

-Kaitlin

Not part of the SDK itself, but if you look at generalUtils.brs in some of the sample channels, there are some sort routines that can do what you want.

“katycorp” wrote:
… to keep track of the search history since the app is specialized enough that using the global search history doesn’t make sense. Since I can only show about 9 items, I’d like to order them by the number of times they were searched for.
I think you will do better if instead of keeping number of times something was searched by and sorting history in descending order by that - instead of that, each when an item is searched, put it on top of the list (i.e. do “most recently used” order instead of “most used” order). This won’t require sorting and is what traditionally is done in many applications. Sorting by # has the disadvantage of not adapting in time, that is if you searched 10 times for “hero” a year ago, it won’t matter you just searched for “vacation” last three times - “hero” be on top of the list