Templating System : API Reference


Access and modify rows and columns of a multirow data source.


multirow get name index column

Get a particular column value or a reference to an entire row.

  • Rows are indexed starting with 1.
  • If a column name is omitted, this procedure will set name to be a reference to an array containing the values for the row specified by index.
multirow set name index column value

Set the value of a column in a specified row.

multirow size name

Get the number of rows in the data source.

multirow create name column [column ...]

Set up a new multirow data source. This is an alternative to having db_multirow create the data source.

multirow append name value [value ...]

Add a row at the end of the data source. Extra values are dropped, missing values default to the empty string

multirow map name body

Evaluate body for each row of the data source, and return a list with all results. Within the body, all columns of the current row are accessible (and modifiable) as local variables. (Not yet committed.)


  template::query foo multirow "select first_name, last_name from users"

  # get the first name of the first user
  set first_name [multirow get foo 1 first_name]

  # get a reference to the entire row
  multirow get foo 1

  # this will the full name of the first user
  set full_name "$foo(first_name) $foo(last_name)"