<table>
<table>
is a special operation that creates a temporary table
within the scope of a query.
Syntax
<table> [ROW1_VAL1], [ROW1_VAL2], [ROW1_VALn]; [ROW2_VAL1], [ROW2_VAL2], [ROW2_VALn]; [ROWz_VAL1], [ROWz_VAL2], [ROWz_VALn] </table>
Alternate Syntax
<table depth="[NUMBER_OF_ROWS]"/> <willbe name="[COL_NAME]" value="[EXPRESSION]"/>
Attributes
depth
depth="[n]"
generates a table of 0 columns andn
rows.depth="0"
generates a (not very useful) table of 0 rows and 0 columns. Ifdepth="[n]"
, columns must be provided via<willbe>
operations.Note: Usingdepth="[n]"
and creating columns with<willbe>
operations as a result is not compatible with manually entering constant data into the table as shown in Example 1 below. Only usedepth="[n]"
when generating code with<willbe>
operations.format
- The
format
attribute controls how the<table>
operation interprets the contents of the data provided to it.(Available as of prod-9)
Note: Specifying theformat
attribute is not always strictly necessary, as the<table>
operation is able to determine the form of the data it is being provided. However, the best practice is to specifyformat
for code readability and general clarity. Furthermore, ifformat="empty"
(e.g., no data is provided in any form),depth
must be provided a value and data must be specified with<willbe>
operations.Accepted values for
format
empty
- By default, if no data is provided to the table,
format
assumes the table is empty. In this instance, thedepth
attribute must specify some number of rows, and data provided via<willbe>
operations. csv
- Assigning
format="csv"
specifies that the data for the table is provided in a list of comma-separated values between the opening and closing tags of<table>
. xml
- Assigning
format="xml"
specifies that the data provided to the<table>
operation is provided in XML according to the 1010data Table Tree specification.
title
- Accepts arbitrary text that provides the title of the new
table.Note:
title
and the following table meta data attributes need not be provided if the data for the new table is specified in XML, as the 1010data Table Tree provides facilities for specifying table information. sdesc
- Accepts arbitrary text that provides the short description of the new table.
ldesc
- Accepts arbitrary text that provides the long description for the new table.
cols
- Accepts a comma-separated string that specifies the column names of the columns
in the new table.
Text provided must be valid 1010data column names (i.e., no spaces or special characters and cannot begin with a number).
labels
- Accepts a comma-separated string that specifies the column headings of the
columns in the new table.
Text provided must be valid 1010data column headings.
types
- Accepts a comma-separated string that specifies the type of each column in the new
table, overriding the default type detection by the system. Accepts the following values:
i
(integer)j
(big integer) (Available as of version 11.25)f
(decimal)a
(text)
For more information, see Data types.
data
- Allows for passing of scalar, list, package, and a table value from a block as data for the new table.
Example
In this example, a table with four rows and three columns is generated.
<table title="Ladybug Picnic" cols="picnic_table_1, picnic_table_2, picnic_table_3" labels="Picnic Table 1,Picnic Table 2, Picnic Table 3"> 1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12 </table>
Example
It is possible to define the number of rows in the table with the depth
attribute, as follows:
<table depth="4"/> <willbe name="test" value="9"/>
In the above example, the table generated will have one column and 4 rows, each row having
the value 9
.
Example
Values may be passed in predefined block variables to the table through the
data
attribute:
<set tab="{table(pkg('a' 'b';lst(1 2) lst(3 4));)}"/> <table data="{@tab}"/>
Example
Using the data
attribute within <dynamic>
tags:
<dynamic> <do on_="init" tablevalue_="foo"> <base table="pub.demo.weather.stations"/> </do> <widget class_="grid"> <table data="{@foo}"/> </widget> </dynamic>