Skip to main content
Version: Java (Groovy)

How to extract values from tables

Deephaven tables have methods to extract values from tables into the native programming language. Generally, this isn't necessary for Deephaven queries but may be useful for debugging and logging purposes, and other specific use cases such as using listeners.


The general syntax to extract a specific value from a table is value = table.getColumnSource("column").get(index).

The getColumnSource method allows you to convert a column to a ColumnSource object.

result = newTable(
intCol("Integers", 1, 2, 3, 4, 5)

columnSource = result.getColumnSource("Integers")

println columnSource

Once you've gotten your column source, you can use its methods. For extracting a table value, you use the get method to retrieve the value of the column at the given index.

println columnSource.get(2)


In cases where you want to loop over all the values in a column, you can use the columnIterator method. This method returns an iterator for all the values in the column.

iterator = result.columnIterator("Integers")

while (iterator.hasNext()) {