rsSortTree

Sorts a ResultSet that is a representation of an XML data structure (with nodes, parent nodes, and depth attributes).

Type and Usage

Parameters

Takes seven parameters. For example:

rsSortTree(rsName,itemIdCol,parentIdCol,nestLevelCol,sortCol,sortType,sortOrder)
Parameter Description
rsName The name of the ResultSet.
itemIdCol The name of the column that contains the unique ID for each node.
parentIdCol The name of the column that contains the ID for the parent node, if one exists.
nestLevelCol The name of the column that contains the nest level (depth) for each node.
sortCol The name of the column to sort by.
sortType The type of sort (defaults to int):

string: sort alphabetically

int: sort numerically

date: sort by date

sortOrder The sort order (defaults to asc):

asc: ascending order

desc: descending order


Output

  • Returns TRUE if the function is successful.

  • Returns FALSE if the function fails or the ResultSet is empty.

Example

Sorts the discussionPosts ResultSet by the itemNumber column in ascending order:

<$rsSortTree("discussionPosts", "discussionPosts!itemNumber", "discussionPosts!parentNumber", "dpItemNestLevel", "discussionPosts!itemNumber", "int", "asc")$>