dynDynSort()
Sorts a dynamic variable field of dyns in ascending or descending order according to a specific column.
Synopsis
int dynDynSort(dyn_dyn_type &dynvar, int | dyn_int col[, bool | dyn_bool
ascending = true]);
Parameters
Parameter | Meaning |
---|---|
dynvar | Variables to be sorted |
col | Position (column) in the dynamic field the dynamic variables should be sorted by. |
ascending |
TRUE = dynamic field will be sorted in ascending order (default) FALSE = dynamic field will be sorted in descending order |
Return Value
Number of elements in the array dyn_dyn.
Errors
A message is issued in the event of incorrect or missing arguments or if there is no variable.
Description
Sorts a dynamic variable field of dyns in ascending or descending order according to a specific column.
Example
main()
{
dyn_dyn_int dd_int;
dyn_int d_int1=makeDynInt(2,5,1);
dyn_int d_int2=makeDynInt(12,1,7);
dyn_int d_int3=makeDynInt(8,20,9,4);
dd_int[1]=d_int1;
dd_int[2]=d_int2;
dd_int[3]=d_int3;
dynDynSort(dd_int, 1); // asc
DebugN(dd_int);
*/ OUTPUT
WCCOAui1:[dyn_dyn_int 3 items
WCCOAui1: 1: dyn_int 3 items
WCCOAui1: 1: 2
WCCOAui1: 2: 5
WCCOAui1: 3: 1
WCCOAui1: 2: dyn_int 4 items
WCCOAui1: 1: 8
WCCOAui1: 2: 20
WCCOAui1: 3: 9
WCCOAui1: 4: 4
WCCOAui1: 3: dyn_int 3 items
WCCOAui1: 1: 12
WCCOAui1: 2: 1
WCCOAui1: 3: 7 */
dynDynSort(dd_int, 2); // asc
DebugN(dd_int);
*/ OUTPUT
WCCOAui1:[dyn_dyn_int 3 items
WCCOAui1: 1: dyn_int 3 items
WCCOAui1: 1: 12
WCCOAui1: 2: 1
WCCOAui1: 3: 7
WCCOAui1: 2: dyn_int 3 items
WCCOAui1: 1: 2
WCCOAui1: 2: 5
WCCOAui1: 3: 1
WCCOAui1: 3: dyn_int 4 items
WCCOAui1: 1: 8
WCCOAui1: 2: 20
WCCOAui1: 3: 9
WCCOAui1: 4: 4 */
dynDynSort(dd_int, 3, 0); // desc
DebugN(dd_int);
*/ OUTPUT
WCCOAui1:[dyn_dyn_int 3 items
WCCOAui1: 1: dyn_int 4 items
WCCOAui1: 1: 8
WCCOAui1: 2: 20
WCCOAui1: 3: 9
WCCOAui1: 4: 4
WCCOAui1: 2: dyn_int 3 items
WCCOAui1: 1: 12
WCCOAui1: 2: 1
WCCOAui1: 3: 7
WCCOAui1: 3: dyn_int 3 items
WCCOAui1: 1: 2
WCCOAui1: 2: 5
WCCOAui1: 3: 1 */
}
Assignment
Availability
CTRL