It may be that hash tables aren't the best option for what you are trying to do. Sorting just isn't really that great for hash tables. However, as DaveC mentioned, you can save the hash table to a file and /filter it, then back reference it to the hash table. This really isn't too difficult to accomplish and the code is somewhere in this forum if you search for it back 1-2 years or so for something like "sorting hash tables". In fact, I think DaveC may have been the one who posted the code.

Basically how that will work is you save the items only and include line numbers. Then filter it by whatever column you need (usually column 2 because column 1 is the line number and column 2 is the item). This lets you sort it by item name (give the items names that can be sorted in the way you want, such as que### (where ### is a number)). After sorting them, you call up the hash table using the line number.

Example:

Unsorted:
Line# Item
1 que4
2 que3
3 que5
4 que1
5 que2

Sorted:
Line# Item
4 que1
5 que2
2 que3
1 que4
3 que5

When you use $hget and the line number for the first item in the sorted list, you'll be looking up $hget(table,4) and you'll get que1's data.

Yes, it's extra work and it does require writing to a file and sorting it that way. So, for this case, using $read and /write may just be easier for what you're trying to accomplish.


Invision Support
#Invision on irc.irchighway.net