Article ID: 246067
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: June 19, 2014 - Revision: 4.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.