category::list::collapse_multirow (public)
category::list::collapse_multirow [ -category_column category_column ] \ -object_column object_column -name name
Defined in packages/categories/tcl/category-list-procs.tcl
Takes a multirow, collapses it so that for each object there's the tcl-list of mapped categories in the category multirow column.
- Switches:
- -category_column (optional, defaults to
"category_id"
)- multirow column name that holds the category_id and will later hold the tcl-list of category_ids
- -object_column (required)
- multirow column name that holds the object_id of the categorized object.
- -name (required)
- name of the multirow
- Author:
- Timo Hentschel <timo@timohentschel.de>
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar 1 ${name}:rowcount rowcount if {$rowcount == 0} { return } set rownum 1 set counter 1 set category_list "" upvar 1 ${name}:1 cur_row while {$counter <= $rowcount} { upvar 1 ${name}:$counter row set row_id $row($object_column) set category_id $row($category_column) if {$category_id ne ""} { lappend category_list $category_id } incr counter if {$counter <= $rowcount} { upvar 1 ${name}:$counter next_row set next_row_id $next_row($object_column) if {$row_id != $next_row_id} { set cur_row($category_column) $category_list set category_list "" incr rownum upvar 1 ${name}:$rownum cur_row array set cur_row [array get next_row] set cur_row(rownum) $rownum } } else { set cur_row($category_column) $category_list } } for {set counter [expr {$rownum+1}]} {$counter < $rowcount} {incr counter} { uplevel 1 unset ${name}:$counter } set rowcount $rownumXQL Not present: Generic, PostgreSQL, Oracle