4D v13

PV SORT MANY

Home

 
4D View v13
PV SORT MANY

PV SORT MANY 


 

PV SORT MANY ( area ; left ; top ; right ; bottom ; direction ; keys ; order ) 
Parameter Type   Description
area  Longint in 4D View area
left  Longint in Left column number
top  Longint in Top row number
right  Longint in Right column number
bottom  Longint in Bottom row number
direction  Integer in 0 = Row; 1 = Column
keys  Array in Column(s) or row(s) containing the values to sort
order  Array in Sort directions: 0 = Ascending; 1 = Descending

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)

 
PROPERTIES 

Product: 4D
Theme: PV Cell manipulation
Number: 15974

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D View 6.8

 
SEE ALSO 

PV SORT COLUMN
PV SORT ONE