Skip to main content
Version: Java (Groovy)

numColumns

The numColumns method returns the number of columns in a table. This is equivalent to getDefinition().getColumns().length.

Syntax

source.numColumns()

Parameters

This method takes no parameters.

Returns

The number of columns defined in the source table.

Example

The following example checks for the existence of certain column names in a table with three columns.

source = newTable(
stringCol("Title", "content"),
stringCol("ColumnName", "column_content"),
stringCol("AnotherColumn", "string"),
)

println source.numColumns()