template::util::multirow_foreach (public, deprecated)

 template::util::multirow_foreach name code_text

Defined in packages/acs-templating/tcl/deprecated-procs.tcl

Deprecated. Invoking this procedure generates a warning.

runs a block of code foreach row in a multirow. Using "template::multirow foreach" is recommended over this routine.

Parameters:
name (required)
the name of the multirow over which the block of code is iterated
code_text (required)
the block of code in the for loop; this block can reference any of the columns belonging to the multirow specified; with the multirow named "fake_multirow" containing columns named "spanky" and "foobar",to set the column spanky to the value of column foobar use:
set fake_multirow.spanky @fake_multirow.foobar@

note: this block of code is evaluated in the same scope as the .tcl page that uses this procedure

Author:
simon
See Also:

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc template::util::multirow_foreach

    upvar $name:rowcount rowcount $name:columns columns i i
    upvar running_code running_code

    for { set i 1} {$i <= $rowcount} {incr i} {

    set running_code $code_text
    foreach column_name $columns {

        # first change all references to a column to the proper
        # rownum-dependent identifier, i.e. the array value identified
        # by $<multirow_name>:<rownum>(<column_name>)
        regsub -all -- "($name).($column_name)" $running_code "$name:${i}($column_name)" running_code
    }

    regsub -all -- {@([a-zA-Z0-9_:\(\)]+)@} $running_code {${\1}} running_code

    uplevel {
        eval $running_code
    }

    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: