<layer>
One or more <layer> elements can be specified within a
<widget class_="text">. Each <layer> contains a
1010data query and can be used to provide data to it. (Available as of version
11.09)
Description
One or more <layer> elements, each containing a 1010data query, may
appear inside the text widget. Each <layer> may bear
one or more value*_ (and associated
row*_/col*_) attributes) and/or a
tablevalue_ attribute.
Variables set thus by layer queries have scope only in subsequent items (other
<layer> tags, text, and
<text>/<html>/<code> forms)
within the widget itself; in other words, they do not change the global
<dynamic> environment and need not be declared in the
<dynamic> clause.
Syntax
<dynamic>
<widget class_="text">
<layer valueN_="[VAR_TO_CHANGE]"
rowN_="[ROW_NUMBER]" colN_="[COL_NUMBER]"
tablevalue_="@TABLE_VAR">
[1010data_QUERY]
</layer>
</widget>
</dynamic>
Attributes
valueN_- Accepts an arbitrary variable name. The value corresponding to the
rowN_and/orcolN_attributes is stored in the variable associated with thevalueN_attribute.Nis a string used as an identifier (e.g.,value1_).More than one value may be stored using multiple
valueN_attributes, whereNis a unique identifier for each and must correspond to the naming of the associatedrowN_and/orcolN_attributes (e.g.,value1_="[VAR]" row1_="[ROW_NUMBER]" col1_="[COLUMN_NUMBER]" valuefoo_="[VAR]" rowfoo_="[ROW_NUMBER]" colfoo_="[COLUMN_NUMBER]", etc.).If a
value_attribute is specified, but no correspondingrow_andcol_attributes, the variable associated with thevalue_attribute is set to the scalar value in the first row of the first column in the result set of the query (or the empty string if there are no rows in the result set). rowN_- Specifies a row number within the result set of the query. The value
corresponding to the
rowN_and/orcolN_attributes is stored in the variable associated with thevalueN_attribute.Nis a string used as an identifier (e.g.,row1_).Together,rowN_andcolN_specify the location of a scalar value within the result set of a query.Note: If bothrowN_andcolN_are 0, table metadata is saved as a package to the variable associated with thevalueN_attribute. (Available as of version 11.19)IfrowN_is provided andcolN_is omitted, all the values in the row will be stored as a package in the variable associated with thevalueN_attribute. The keys of the package are the column names in the result set of the query, and the values can be referenced as@[VAR].[COLUMN_NAME].Note: If the value ofrowN_is 0, column metadata is saved as a package to the variable associated with thevalueN_attribute. (Available as of version 11.19)More than one row value may be specified using multiple
rowN_attributes, whereNis a unique identifier for each. Note that the naming of a particularrowN_attribute must correspond to the naming of the associatedvalueN_andcolN_attributes (e.g.,value1_="[VAR]" row1_="[ROW_NUMBER]" col1_="[COLUMN_NUMBER]" valuefoo_="[VAR]" rowfoo_="[ROW_NUMBER]" colfoo_="[COLUMN_NUMBER]", etc.).If the value of
rowN_is a negative number, the row that number of rows back from the last row is used. (Available as of version 11.19) colN_- Specifies either a column name or column number within the result
set of the query. The value corresponding to the
rowN_and/orcolN_attributes is stored in the variable associated with thevalueN_attribute.Nis a string used as an identifier (e.g.,col1_).Together,rowN_andcolN_specify the location of a scalar value within the result set of a query.Note: If bothrowN_andcolN_are 0, table metadata is saved as a package to the variable associated with thevalueN_attribute. (Available as of version 11.19)IfcolN_is provided androwN_is omitted, all the values of the column will be stored as a list-value in the variable associated with thevalueN_attribute.Note: If the value ofcolN_is 0, a list of the row numbers is saved as a list-value to the variable associated with thevalueN_attribute. (Available as of version 11.19)More than one column value may be specified using multiple
colN_attributes, whereNis a unique identifier for each. Note that the naming of a particularcolN_attribute must correspond to the naming of the associatedvalueN_androwN_attributes (e.g.,value1_="[VAR]" row1_="[ROW_NUMBER]" col1_="[COLUMN_NUMBER]" valuefoo_="[VAR]" rowfoo_="[ROW_NUMBER]" colfoo_="[COLUMN_NUMBER]", etc.).If the value of
colN_is a negative number, the column that number of columns back from the last column is used. (Available as of version 11.19) tablevalue_- Accepts the name of a variable to which the
<layer>can assign the result of the [1010data_QUERY] as a table value.The variable associated with this attribute can be indexed using the following syntax:@foo.barprovides a list consisting of the values in the columnbar@foo.17provides a dictionary consisting of the row 17@foo._colsprovides a list of column names@foo._rowsprovides the number of rows
Example: Using <layer> and <text> within the
text widget
<dynamic store="1"> <layout arrange_="v"> <widget class_="dropdown" label_="Select a store" value_="@store"> <table>1;2;3 </table> </widget> <widget class_="text"> <layer value_="@totalsales" row_="1" col_="1"> <base table="pub.demo.retail.item"/> <tabu breaks="store"> <tcol source="sales" name="sumsales" fun="sum" label="Sales"/> </tabu> <sel value="store={@store}"/> <colord cols="sumsales"/> </layer> <text>The total sales for store {@store} is ${@totalsales}. </text> </widget> </layout> </dynamic>

Example: Using <layer> with tablevalue_
The following example demonstrates how a <layer> is used to specify a
query that provides data for the text widget. In this example, the results
of the query is saved in a table-value variable named stores. That variable
is then accessible to the text specified after the <layer> tag. The text
references the stores variable to display the store and city associated
with the selection made in the dropdown widget.
<dynamic selection="1"> <layout arrange_="v"> <widget class_="dropdown" label_="Select a store" value_="@selection"> <table>1;2;3 </table> </widget> <widget class_="text" visible_="{@selection<>''}"> <layer tablevalue_="@stores"> <base table="pub.demo.retail.store"/> </layer> Store {@stores.store[@selection]} is located in {@stores.city[@selection]}. </widget> </layout> </dynamic>

