ph_sortdata PowerHome formula function
Description
Sorts the data in a Data Retrieval area 
Syntax
ph_sortdata ( ai_dsvar, as_sort )
Argument Description
ai_dsvar Integer. The Data Retrieval area number you wish to sort. Valid values are 1 thru 20
as_sort String. The sort description to be performed. See Usage below
Return value
Long. Returns 0 if successful. Returns -1 if the ai_dsvar parameter is out of range (1 - 20). Returns -2 if the Data Retrieval area is not initialized. Returns -3 if the specified sort is not valid. Returns -4 if the sort fails. 
Usage
Use this function sort previously retrieved data in a Data Retrieval area 

The as_sort parameter is a string containing 1 or more columns that you would like to sort by with the option of specifying either an ascending or descending sort. You can use either the column name or a column number. If you use a column number, prefix the number with the pound "#" sign. If you don't specify "a" (ascending) or "d" (descending) the default will be ascending. Sample sort strings are below:

  • "#1 a, #2 d"
  • "ddtype, dddisplay"
  • "address d"
  • Examples
    The following examples demonstrate typical syntax/usage for this function.
    • ph_sortdata(1,"#1 a, dddisplay d") - Returns 0 if successful. Sorts Data Retrieval area 1 first by the 1st column ascending and then by the column named "dddisplay" descending