Command PV SORT MANY

4D View

PV SORT MANY

version 6.8


PV SORT MANY (area; left; top; right; bottom; direction; keys; order)

ParameterTypeDescription
areaLongint4D View area
leftLongintLeft column number
topLongintTop row number
rightLongintRight column number
bottomLongintBottom row number
directionInteger0 = Row; 1 = Column
keysArrayColumn(s) or row(s) containing the values to sort
orderArraySort directions: 0 = Ascending; 1 = Descending

Description

The PV SORT MANY command is similar to PV SORT ONE but with multi-sort. You must pass columns or rows serving as sort criteria in key and the order (ascending or descending) in which the sorts will be executed in order.

The sort is executed in the cell selection delimited by left, top, right, and bottom.

direction indicates if the sort should arrange rows or columns:

• If you pass 0, you arrange rows depending on the values of the row keys.

• If you pass 1, you arrange columns depending on the values of the column keys.

Example

Sort a cell selection (5 columns x 9 rows) in relation to the second column as the first ascending criteria and in the third column as the second descending criteria.

   ARRAY LONGINT($Keys;2)  `Column(s) or row(s) containing values to sort
   ARRAY INTEGER($Orders;2)  `0=Ascending / 1=Descending

      `Initialization
   $Keys{1}:=3  `The 2nd column of the selection serves as 1st sort criteria
   $Keys{2}:=4  `The 3rd column of the selection serves as the 2nd sort criteria
   $Orders{1}:=0  `Ascending sort for the rows of the 2nd column of the selection
   $Orders{2}:=1  `Descending sort for the rows of the 3rd column of the selection

   PV SORT MANY (Area;2;2;6;10;1;$Keys;$Orders)

See Also

PV SORT COLUMN, PV SORT ONE.