Table

Represents table object (usually it’s value of table DCI).

Instance attributes

columnCount: int

Number of columns.

columns: Array<TableColumn>

Array of column definitions.

instanceColumns: Array<TableColumn>

Array of column definitions including only columns marked as instance columns.

instanceColumnIndexes: Array<Integer>

Array with indexes of columns marked as instance columns.

rowCount: int

Number of rows.

rows: Array<TableRow>

Array of rows with data.

title: String

Title of table.

Instance methods

addColumn(name, [type], [displayName], [isInstance]): int

Adds column to table

Table 1. Parameters

name

String

Column name

type

Integer

Data type, optional parameter. Default is String

displayName

String

Column display name, optional parameter

isInstance

Boolean

True if column is instance column, optional parameter. Default is false

Return

Column index

addRow(): int

Adds row to table

Return

Row index

deleteColumn(columnId): void

Delete column

Table 2. Parameters

columnId

Integer

Column index

deleteRow(rowId): void

Delete row

Table 3. Parameters

rowId

Integer

Row index

findRowByInstance(instance, instance2, …​) ⇒ TableRow

Finds row by instance

Table 4. Parameters

instance

String

Instance string

instance2

String

Optional. If instance is composed of several columns, these can be supplied as additional parameters.

Return

Table row that corresponds to provided instance, or null if not found

findRowIndexByInstance(instance, instance2, …​): int

Finds row index by instance.

Table 5. Parameters

instance

String

Instance string

instance2

String

Optional. If instance is composed of several columns, these can be supplied as additional parameters.

Return

Index of the table row that corresponds to provided instance, or -1 if not found

get(rowId, columnId): String

Get cell value by row and column id

Table 6. Parameters

rowId

Integer

Row index

columnId

Integer or String

Column index or column name

Return

Cell value as string, or null if row or column does not exist

getColumnIndex(columnName): int

Get column index by column name

Table 7. Parameters

columnName

String

Column name

Return

Column index or -1 if column not found

getColumnName(columnId): String

Get column name by column index

Table 8. Parameters

columnId

Integer

Column index

Return

Column name or null if no column with given index

print(): void

Prints formatted table with header and contents

set(rowId, columnId, value): void

Set column value by row and column index

Table 9. Parameters

rowId

Integer

Row index

columnId

Integer or String

Column index or column name

value

String

New value

trace(tag, level, prefix, headers, delimiter): void

Dump formatted table to log

Table 10. Parameters

tag

String

Debug tag; "nxsl.trace" is used if null

level

Integer

Debug level

prefix

String

Optional prefix that will be added before each line in log file, default is empty string

headers

Boolean

Optional, print header line with column names, default true

delimiter

String

Optional field separator (first character of the string is used), default ','

Constructors

Table()

Creates new Table object.