Skip to main content
Version: Java (Groovy)

moveColumnsDown

The moveDownColumns method creates a new table with specified columns appearing last in order, to the far right.

Syntax

table.moveColumnsDown(columnsToMove...)

Parameters

ParameterTypeDescription
columnsToMoveString...

Columns to move to the right side of the new table. Columns can be renamed with syntax matching NewColumnName=OldColumnName.

Returns

A new table with specified columns appearing last in order, to the far right.

Examples

The following example moves column B to the last position in the resulting table.

source = newTable(
stringCol("A", "apple", "apple", "orange", "orange", "plum", "plum"),
intCol("B", 1, 1, 2, 2, 3, 3),
stringCol("C", "Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"),
intCol("D", 1, 2, 12, 3, 2, 3),
)

result = source.moveColumnsDown("B")

The following example moves columns B and D to the last positions in the resulting table.

source = newTable(
stringCol("A", "apple", "apple", "orange", "orange", "plum", "plum"),
intCol("B", 1, 1, 2, 2, 3, 3),
stringCol("C", "Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"),
intCol("D", 1, 2, 12, 3, 2, 3),
)

result = source.moveColumnsDown("B", "D")