VI Sort Process Object
The Visual Integrator (VI) Sort process object changes the order in which the data flow appears in subsequent objects.
The Sort object uses temporary files if there is not enough memory to perform the sort in memory. All input rows are preserved without collapsing or combining data. Use a Squash process object after the sort if you wish to combine data. For more information, see VI Squash Process Object.
The Sort process object has three panes where you set attributes.
You set attributes for the Sort process object in the object attributes pane.
Attribute | Description |
---|---|
Input |
Defines the object from which the data flow arrives. Use one of the following methods to attach the Sort object to an input data flow object:
|
Reverse_All |
Defines the direction the order is sorted.
|
Case_Sensitive |
Controls whether comparisons are case-sensitive.
|
Locale |
Defines whether or not the sort comparisons use the locale collation sequence to reflect international sort sequences.
|
Sort_Size | Defines an approximate amount of memory assigned for the sort, in bytes. If the data volume exceeds this size, the sort object switches to an external sort and use temporary files for intermediate results. The maximum sort sized is limited to 2,147,483,647 bytes, which is approximately 2 GB. |
Temp_Directory | Defines the directory to use for any temporary files required to process the sort. DI recommends you set this optional attribute to a location known to have enough space for the data flowing through the Sort object. Click the browse button that appears in the Temp_Directory box to choose a location. |
Each object has an area where you can enter comments.
It is a DI best practice to enter a note for every object in a VI script. You can set a VI preference to give a warning for each object without a note.
The Sort column grid displays the input columns where you can define the sort order and set other attributes.
Attribute | Description |
---|---|
Input Column | Displays the name of each input column. This attribute is read-only. |
Source Object |
Displays the name and object type of the source object. Double-click the Source Object for a column to change the task flow focus to that object. |
Sort Order |
Defines which input columns control the sort.
One column must be specified as the primary sort. |
Numeric |
Defines which columns are treated as numeric values. Values in these columns are compared numerically, instead of alphabetically. When selected, a number is automatically added to the Sort Order column. |
Reverse |
Defines which sort columns are sorted in reverse order. This attribute and the Reverse_All attribute are combined with an exclusive OR. If a Reverse column is selected and the Reverse_All attribute is set to true, the reverse function is applied twice and the column sorts in ascending order. When selected, a number is automatically added to the Sort Order column. |
This example sorts an input file with people's names and ages.
With the following input data:
-
Set the Sort Order to 1 for the Person column and 2 for the Age column.
-
Save the tab.
-
Right-click the Sort object, and click Test Object.
The Results displays the sorted columns.
NOTE: The data is sorted based on the primary sort, the Person column. Rows with the same name are secondarily sorted by Age column.