workflow::tree::sorter::sort (public)

 workflow::tree::sorter::sort -multirow multirow

Defined in packages/workflow/tcl/workflow-tree-procs.tcl

Sort the given multirow using the full-sort-keys built earlier by the calls to tree::sorter proc tree::sorter::make_full_key_for created with tree::sorter::create.

Switches:
-multirow
(required)
The name of the multirow data-source to be sorted.
Author:
helsleya@cs.ucr.edu
See Also:
  • tree::sorter::create
  • tree::sorter::make_full_key_for

Partial Call Graph (max 5 caller/called nodes):
%3 packages/workflow/www/admin/workflow-ae.tcl packages/workflow/ www/admin/workflow-ae.tcl workflow::tree::sorter::sort workflow::tree::sorter::sort packages/workflow/www/admin/workflow-ae.tcl->workflow::tree::sorter::sort packages/workflow/www/admin/workflow-clone.tcl packages/workflow/ www/admin/workflow-clone.tcl packages/workflow/www/admin/workflow-clone.tcl->workflow::tree::sorter::sort

Testcases:
No testcase defined.
Source code:
    # Get access to state-variables
    upvar   ${multirow}_tree_sorter_sort_column     sort_by
    upvar   ${multirow}_tree_sorter_sorted_rows     rows
     
    # Get access to the data
    set rows [uplevel "template::util::multirow_to_list $multirow"]
    
    if {[llength $rows] > 1} {
    # Find the correct index to sort by
    set header_row  [lindex $rows 0]
    set sort_index  [expr 1 + [lsearch -exact $header_row $sort_by]]
    
    # Sort the data
    set rows        [lsort -index $sort_index $rows]
    
    # Convert the data back into a multirow data-source
    uplevel "template::util::list_to_multirow $multirow \$${multirow}_tree_sorter_sorted_rows"
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: