tabledata(T;K;I)

Returns information about a given table based on a specified key. Certain keys, which return information about particular columns or data segments, require an index.

Syntax

tabledata(T;K;I)

Input

Argument Type Description
T text The path to the table about which you would like information
Note: The table must have been opened via a data transformation operation such as <base> or <link> prior to calling this function. Otherwise, an error will occur.
K text The key that specifies what information you would like

A full list of keys is provided below.

Note: The key must be enclosed within single quotes.
I integer The index position of the item you want information about

Keys that return information about columns or data segments require an index to specify the particular item for which you want information. For instance, if you specify a key that returns information about a column, the index specifies which column.

Keys that return more general information about the table, such as the short description or title, do not require an index. For these keys, you can omit this parameter.

Keys without index

Certain keys provided to the K parameter of the tabledata(T;K;I) function return general information about the table. These keys do not require a value for the I parameter, which can be omitted. The information returned by the tabledata(T;K;I) function is specific to the key used in the K parameter. The returned values for each key are listed below.

bytes
Decimal value representing the physical size of the object in bytes
columns
A comma-separated list of the columns in the table
ctype
Integer representation of the type of data
Valid values are:
0 table
1 non-parameterized Quick Query
2 parameterized Quick Query
3 uploaded query (deprecated)
4 merged table
5 tolerant merged table (ignores missing tables)
filtered
Returns 1 if the table is filtered for the current user

Returns 0 if the table is not filtered for the current user

(Available at of version 15.00)

hasfilter
Returns 1 if a filter exists

Returns 0 if no filter exists

(Available at of version 15.00)

id
Integer value representing a unique identifier
indexcols
Returns a comma-separated string of indexed columns associated with the table
keys
ldesc
Long description
linkheader
Link header
maxdown
Maximum number of cells in the table that you can download
Note: The number of cells in a table is calculated by multiplying the number of rows by the number of columns.
ncols
Number of columns in the table
nprelinks
Number of prelinks associated with the table
nsegs
Number of segments in the table
owner
Username of the owner
path
Full path to the object
sdesc
Short description
secure
Boolean value indicating whether SSL encryption is required (deprecated)
Note: Since SSL encryption is always required when using 1010data, this value no longer has any significance.
segby
Comma-separated list of columns used to segment the new table
sortseg
Comma-separated list of columns used to sort and segment the new table
title
The label associated with the object
ts
Integer value representing the timestamp of the last modification
type
The type of object
Valid values are:
dir folder
tab table
users
A comma-separated list of users or groups that have read access to the table

An N/A value indicates that the table inherits the permission of the parent folder.

Keys with index

Certain keys provided to the K parameter of the tabledata(T;K;I) function return information about columns or data segments. These keys require a value for the I parameter, which specifies the particular column or data segment for which you want information. The information returned by the tabledata(T;K;I) function is specific to the key used in the K parameter. The returned values for each key are listed below.

The following keys return information related to the columns within the table. The index provided by the I parameter for these keys is 1-based (i.e., specify a value of 1 to get information about the first column in the table, 2 to get information about the second column, and so on).

col_case
Capitalization applied to column
col_desc
Description of the column
col_fixed
Boolean value indicating whether or not the column is fixed
col_format
Display format for the column, if set

If a display format has not been specifically set for a particular column, the tabledata(T;K;I) function will return N/A for this key.

col_label
Column label
col_name
Column name
col_type
Column type
Valid values are:
i integer
f decimal
a text
col_width
Column width, if set

If a column width has not been specifically set for a particular column, the tabledata(T;K;I) function will return N/A for this key.

prelink_path
The prelinked path
prelink_col
A comma-separated string of the local columns associated with the prelink
prelink_col2
A comma-separated string of the foreign columns associated with the prelink
prelink_ts
The timestamp associated with the prelink
The following keys return information related to the segments within the table. The index provided by the I parameter for these keys is 0-based (i.e., specify a value of 0 to get information about the first segment in the table, 1 to get information about the second segment, and so on).
dataloc_from
First row number in the segment
dataloc_to
Last row number in the segment
dataloc_mach
Server on which the segment exists
Note: A comma-separated list of server names indicates that the segment is mirrored on those servers.
dataloc_path
Absolute path on the server where the segment exists

Return Value

Returns a scalar value related to the key specified by the K parameter for the table specified by the T parameter. If the key returns information about columns or data segments, the I parameter specifies which one.
Note: If placed in a vector expression, this function returns a vector of a single value according to the key passed to K and index value passed to I.

Example: Key without index

The following example creates a computed column that displays the size of the table pub.demo.weather.hourly90. (Note that the I parameter for tabledata(T;K;I) must still be accounted for within the function call by including an empty value after the last semicolon.)

<base table="pub.demo.weather.hourly90"/>
<willbe name="size" 
 value="'{tabledata('pub.demo.weather.hourly90';'bytes';)}'"/>
<colord cols="size"/>
<sel value="i_=1"/>

Example: Key with index (segment information)

The following example creates a computed column that displays a comma-separated list of the servers on which the third segment of the table pub.demo.weather.wunderground.observed_daily is stored. (Note that the index specified by the I parameter for tabledata(T;K;I) is 0-based for keys related to segments.)

<base table="pub.demo.weather.wunderground.observed_daily"/>
<willbe name="machs" 
 value="'{tabledata('pub.demo.weather.wunderground.observed_daily';
                    'dataloc_mach';2)}'"/>
<colord cols="machs"/>
<sel value="i_=1"/>

Example: Key with index (column information)

The following example creates a computed column that displays the description for the third column of the table pub.demo.retail.item. (Note that the index specified by the I parameter for tabledata(T;K;I) is 1-based for keys related to columns.)

<base table="pub.demo.retail.item"/>
<willbe name="desc" 
 value="'{tabledata('pub.demo.retail.item';'col_desc';3)}'"/>
<colord cols="desc"/>
<sel value="i_=1"/>