Article ID: 246067 - View products that this article applies to.
This article was previously published under Q246067
A Scripting Dictionary object is the equivalent of a PERL associative array, where information is stored in an array consisting of unique keys and item data. Because this information is stored unsorted, enumerating through the array returns information in the order it was stored. The purpose of this article is to define the SortDictionary() function that sorts the contents of a dictionary object populated with string data by key or item.
The following code example defines two constants, dictKey and dictItem, which are used by the SortDictionary() function. The SortDictionary() function takes two parameters, an object previously created as a scripting dictionary and one of the constants to determine whether to sort by the dictionary's keys or items.
A Working ExampleThe following example makes use of the above function.
Note: All comments have been removed from the actual sorting function in this example.
Copy the following ASP code and save it to a folder as Sortdemo.asp with at least Scripts access:
When browsed, the following output should be displayed:
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
https://partner.microsoft.com/global/30000104For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
For more information on Microsoft's scripting technologies, see the Microsoft Developer Network Web site at the following URL:
Article ID: 246067 - Last Review: August 8, 2007 - Revision: 3.3
Contact us for more help
Connect with Answer Desk for expert help.