Structsort - MACROMEDIA COLDFUSION 5 - CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION 5 - CFML:
Table of Contents

Advertisement

624

StructSort

Description
Returns an array of structures containing top-level key names (strings) sorted
according to the value of the specified subelement. The value of the keys may be
simple values or complex elements.
StructSort( base, pathToSubElement, sortOrder, sortType )
Syntax
See also
StructDelete
StructKeyArray, StructKeyExists, StructKeyList, StructCount, StructNew,
StructUpdate, StructAppend, StructFindKey,
Parameters
Parameter
base
pathToSubElement
sortType
sortOrder
Usage
The pathToSubElement string does not support array notation so only substructures
of structures are supported.
Example
<cfscript>
</cfscript>
,
StructFind, StructGet, StructInsert, StructIsEmpty,
Description
A ColdFusion struct with one field (an associative array).
The path to apply to each of the top-level keys in order to reach
the element whose value you wish to sort by. If unspecified,
pathToSubElement, defaults to nothing: meaning that the
top-level entries will be sorted based on their own values.
The sort type. Options are "NUMERIC", "TEXT", or
"TEXTNOCASE". The default is "TEXT."
The sort order. Options are "ASC" (ascending) or "DESC"
(descending). The default is "ASC."
salaries = StructNew() ;
employees = StructNew() ;
departments = StructNew() ;
for ( i=1; i lt 6; i=i+1 )
{
salary = 120000 - i*10000 ;
salaries["employee#i#"] = salary ;
employee = StructNew() ;
employee["salary"] = salary ;
// employee.salary = salary ;
employees["employee#i#"] = employee ;
departments["department#i#"] = StructNew() ;
departments["department#i#"].boss = employee ;
}
Chapter 3 ColdFusion Functions
StructClear

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 5 - CFML and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 5

Table of Contents