SpatialSort Command 

Use the SpatialSort command in a Logic Template to sort results by distance from a defined coordinate pair, using a pair of fields containing numeric values. 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 Spatial Sort request, use the SpatialSort command with four arguments:
SpatialSort( fld1, fld2, cntr, pas );
SpatialSort Arguments
Argument 
Description 
fld1 
The name of the data field containing the X coordinate to be sorted. 
fld2 
The name of the data field containing the Y coordinate to be sorted. 
cntr 
The name of the HTML variable containing the center point coordinate pair. 
pas 
The pass during which the sort is to be executed. 
Access the SpatialSort Dialog Box by selecting the Spatial menu item under the Sorting category of the Logic Template editor command menu.
Examples
Command 
Description 
Center = { 32, 47 }; SpatialSort( _Field_X, _Field_Y, Center, 2); 
Sort results by distance from the point with X coordinate 32 and Y coordinate 47 during pass 2. Use data coordinates stored in fields "_Field_X" and "_Field_Y". 
IF ( Center ) SpatialSort( _Field_X, _Field_Y, Center, 1); ENDIF 
Sort results by distance from the point with coordinates stored in HTML variable "Center" during pass 1, if "Center" is not empty. Use data coordinates stored in fields "_Field_X" and "_Field_Y".
