workflow::tree::sorter::create (public)

 workflow::tree::sorter::create -multirow multirow -sort_by sort_by

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

Initiliaze a bunch of state variables for a connect by ordered tree.

Example:


    # Create a 'sorter' to sort the data
    tree::sorter::create -multirow categories_tree -sort_by sort_key
    
    # Get the data
    db_multirow -extend {sort_key} categories_tree categories_tree_sql {
	select  lpad(' ', 6*4*(level-1) + 1, ' ') || name as name,
	category_id,
	name as rawname,
	level
	from  categories
	connect by prior category_id    = parent_category_id
	start with parent_category_id   = category.lookup('//Personnel Title')
    } {
	set sort_key [tree::sorter::make_full_key_for       -multirow     categories_tree   -partial_key  $rawname          -id           $category_id      -level        $level]
    }
    
    # Sort the data
    tree::sorter::sort -multirow categories_tree
    

Switches:
-multirow (required)
The name of the multirow data-source to make sort-keys for.
-sort_by (required)
The name of the column that will be populated with the sort-key.
Author:
helsleya@cs.ucr.edu
See Also:
  • tree::sorter::make_full_key_for
  • 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::create workflow::tree::sorter::create packages/workflow/www/admin/workflow-ae.tcl->workflow::tree::sorter::create packages/workflow/www/admin/workflow-clone.tcl packages/workflow/ www/admin/workflow-clone.tcl packages/workflow/www/admin/workflow-clone.tcl->workflow::tree::sorter::create

Testcases:
No testcase defined.
Source code:
    # Get access to state-variables
    upvar   ${multirow}_tree_sorter_sort_stack      stack
    upvar   ${multirow}_tree_sorter_sort_column     saved_sort_by
     
    # Initialize state-variables
    set             stack                                                           [list]
    set             saved_sort_by                                           $sort_by
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: