Hi. I’m trying to find the last value in a column and print it. I’ve tried
table.getRowCount.getString
but can’t get it to work, it says getRowCount doesn’t exist.
Sorry if this is very basic.
Hi. I’m trying to find the last value in a column and print it. I’ve tried
table.getRowCount.getString
but can’t get it to work, it says getRowCount doesn’t exist.
Sorry if this is very basic.
getRowCount() returns number of rows in the table. To get the last row of the table would be table.getRow(table.getRowCount))
and there might be the traditional indexing error. If table row indexing starts from zero you might need to decrease getRowCount() by one.
I tried that and it prints “processing.data.Table$RowPointer@” and 8 alphanumeric characters.
Because it’s not data, it’s a reference to the last row. You need to refer to a column on the row too get data. Reference / Processing.org
This would print value from column ‘name’ on the last row
println(table.getString(table.getRow(table.getRowCount)), "name"));
getString expects int,int. How would I address that?
There are two getSrings (int, int) and (int,string). You can use either. If you look for values in a named column you use (int, string). If you want to loop through all columns on a row you use (int, int). If you look at table reference Reference / Processing.org you can find all functions and under function you can find code examples.
There is also
table.getColumnCount()
which gives you amount of columns in the table