Structsort - MACROMEDIA COLDFUSION MX 61-CFML Reference

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

Advertisement

StructSort

Description
Returns a sorted array of the top level keys in a structure. Sorts using alphabetic or numeric
sorting, and can sort based on the values of any structure element.
Returns
An array of top-level key names (strings), sorted by the value of the specified subelement.
Category
Structure functions
Function syntax
StructSort(base, sortType, sortOrder, pathToSubElement)
See also
Structure functions
Parameters
Parameter
base
sortType
sortOrder
pathToSubElement
Usage
The
pathToSubElement
of structures.
This function does not sort or change the structure.
Example
<cfscript>
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 ;
714
Chapter 3: ColdFusion Functions
Description
A ColdFusion struct with one field (an associative array).
• numeric
• text: case sensitive (all lower-case letters precede the first upper-case
letter). Default.
• textnocase
• asc: ascending (a to z) sort order. Default.
• desc: descending (z to a) sort order
String or a variable that contains one.
Path to apply to each top-level key, to reach element value by which to sort.
Default: nothing (top-level entries sorted by their own values).
string does not support array notation, and only supports substructures

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents