LinearSort Command 

Use the LinearSort command in a Logic Template to sort results from closest to a defined base value to furthest from that value, using a field containing numeric values. The values are sorted using the absolute value of the difference between each value and the defined base value. The values are assumed to be signed integers or fixed point data with an implied decimal point
Integer values stored within a numeric field must be greater than 4294967296 and less than 4294967296. Values greater than or equal to 4294967296 will be treated as negative. Fixed point data with 2 implied decimal places must be greater than 42949672.96 and less than 42949672.96. The limits for fixed point data with other than 2 implied decimal places is adjusted in the same way by moving the decimal point.
To execute a Linear Sort request, use the LinearSort command with three arguments:
LinearSort( fld, cntr, pas );
LinearSort Arguments
Argument 
Description 
fld 
The numeric data field on which to sort. 
cntr 
The HTML variable containing the base value around which to sort. 
pas 
The pass during which the sort is to be executed. 
Access the LinearSort Dialog Box by selecting the Linear menu item under the Sorting category of the Logic Template editor command menu.
Examples
Command 
Description 
Cost = 2500; LinearSort( _TicketPrice, Cost, 1); 
Sort results by the field "_TicketPrice" for values around $25.00 during pass 1. Assume "_TicketPrice" contains fixed point data with 2 decimal places. 
IF ( Cost ) LinearSort( _TicketPrice, Cost, 2); ENDIF 
Sort results by the field "_TicketPrice" around the value stored in the HTML variable "Cost" during pass 2 if the value is nonzero. 