| 4D View v15PV SORT ONE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D View v15
 PV SORT ONE 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PV SORT ONE ( area ; left ; top ; right ; bottom ; direction ; key ; order ) | ||||||||
| Parameter | Type | Description | ||||||
| area | Longint |   | 4D View area | |||||
| left | Longint |   | Left column number | |||||
| top | Longint |   | Top row number | |||||
| right | Longint |   | Right column number | |||||
| bottom | Longint |   | Bottom row number | |||||
| direction | Integer |   | 0 = Row sort; 1 = Column sort | |||||
| key | Longint |   | Column or row containing the values to sort | |||||
| order | Integer |   | 0 = Ascending; 1 = Descending | |||||
The PV SORT ONE command sorts the contents of the selection delimited using left, top, right, and bottom in relation to values contained in the row or column key, in the order defined by order.
direction indicates if the sort should arrange rows or columns:
This command only operates with static data.
Dynamic areas (arrays and linked fields) must be sorted using 4D commands — the principle consists of sorting the source. An example of sorting dynamic columns linked to fields when the header is clicked on is supplied in the description of the  PV GET CELL FIELD command. Note that sorting is not possible on picture type arrays and fields nor on calculated columns (that call a callback method and display its result).
This example allows an ascending sort of static columns by clicking on the column header. The area only contains static columns.
 PV ON EVENT(area;pv on clicked;"HeaderSortMethod")  `HeaderSortMethod method
 C_BOOLEAN($0)
 C_LONGINT($1;$2;$3;$4;$5;$6)
 
 If($5=0) `If the click takes place on a header
    $0:=True `Blocks the event
    PV SORT ONE(area;$4;1;$4;25;1;$4;0) `Ascending sort of the selected column
 End if
	Product:  4D View
	Theme:  PV Cell manipulation
	Number:  
        15975
        
        
        
	
	Created:  4D View 6.8
	
	
	
	
	
	
	
	
	4D View Language ( 4D View v15)
	
	
	
	
	
	
	
 Add a comment
Add a comment