workflow::tree::sorter::make_full_key_for (public)

 workflow::tree::sorter::make_full_key_for -multirow multirow \
    -partial_key partial_key -id id -level level

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

Make a key that can be stored with the given row in a connect by-ordered tree. This updates some state variables and makes a key from their values. Once all rows are processed, a call to tree::sorter::sort should be made to sort the multirow data.

Switches:
-multirow
(required)
The name of the multirow data-source to make a sort-key for.
-partial_key
(required)
The primary field by which the tree will be (hierarchically) sorted.
-id
(required)
The ID to be used as a tie-breaker when sorting. This should be a candidate-key.
-level
(required)
The depth of the node uniquely identified by id
Returns:
A key for sorting rows in a tree
Author:
helsleya@cs.ucr.edu
See Also:
  • tree::sorter::create
  • tree::sorter::sort

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::make_full_key_for workflow::tree::sorter::make_full_key_for packages/workflow/www/admin/workflow-ae.tcl->workflow::tree::sorter::make_full_key_for packages/workflow/www/admin/workflow-clone.tcl packages/workflow/ www/admin/workflow-clone.tcl packages/workflow/www/admin/workflow-clone.tcl->workflow::tree::sorter::make_full_key_for

Testcases:
No testcase defined.
Source code:
    # Get access to state-variables
    upvar ${multirow}_tree_sorter_sort_stack        stack
    
    set top         [llength $stack]
    set newtop      [expr {$level - 1}]
     
    # Pop from the top of the stack and the sort-key if necessary
    if {$newtop < $top && $newtop >= 0} {
    set stack   [lreplace $stack $newtop end]
    }
    
    # Push current node onto stack and sort-key
    lappend stack   "$partial_key $id"
    set             full_sort_key   "//[join $stack //]"
    
    return $full_sort_key
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: