Setting Up the ExtSort Component
Double-click the ExtSort component.
Click the Sort key row in the component editor. A button appears in this row.
Figure 3.2. Editing ExtSort Component
Use the button to open Sort Key dialog:
Figure 3.3. Selecting a Sort Key
Select the key that will be used for sorting the incoming records.
Drag the Salary
item from the
Fields pane and drop it to the Sort key pane.
Do the same with LastName
and FirstName
items in this order.
Figure 3.4. Sort Key Selection
Click the cell in the Order column right from the salary
item
and select Descending
instead of Ascending
.
This way you have selected the fields according to which the incoming records should be sorted.
The records will be sorted according to the salary
field values in descending order.
Records with same salary
will be sorted according to lname
in ascending order.
Records the same salary
and lname
will be sorted according to
fname
in ascending order.
Thus, any person with salary
of
25000
would be sent out after any other person with
salary of 28000
.
And, within the same salary
, any Brown
would be sent out
through the output port before any Smith
.
And again, within the same salary, any John Smith
would be sent
out before any Peter Smith
.
In other words, the fields located higher in the Key parts pane have higher sorting priority.
Figure 3.5. Sort Key Selection
After clicking OK, a sequence of field names separated by semicolon will appear in the component editor:
Figure 3.6. Sort Key Appearance
Run the graph and see the results.
You can see that all salaries are sorted in descending order.
Note that within the same salary of 30000 both Browns
lies
above George Smith
and that Albert Brown
lies higher than Peter Brown
.