Skip to main content
Version: Java (Groovy)

Create tables from scratch with newTable

newTable

Columns are created using the following methods:

result = newTable(
intCol("IntegerColumn", 1, 2, 3),
stringCol("Strings", "These", "are", "Strings"),
)

Query language formulas

var = 3

f = { a, b -> a + b }

source = newTable(intCol("A", 1, 2, 3, 4, 5), intCol("B", 10, 20, 30, 40, 50))

result = source.update("X = A + 3 * sqrt(B) + var + (int)f(A, B)")

Create new columns in a table

scores = newTable(
stringCol("Name", "James", "Lauren", "Zoey"),
intCol("Math", 95, 72, 100),
intCol("Science", 100, 78, 98),
intCol("Art", 90, 92, 96),
)

total = scores.update("Total = Math + Science + Art")
average = scores.update("Average = (Math + Science + Art) / 3 ")