Tables: Getting a row's ID?

Hi,

Is there a very sensible way to get a row ID given a row variable?

I seem to be able to get everything else via eg. getInt, but while I'm able to adjust values on a given row, there doesn't appear to be a logical way to use "removeRow" because I can't extract the ID

Does anyone have any clues here? Thanks in advance.

Answers

  • edited December 2016

    get a row ID given a row variable

    Does your table data contain a unique ID column? If so, use Table.findRow and provide the ID column name and value as the search terms. This will return a Table row index, which you can pass to removeRow.

    https://processing.org/reference/Table_findRow_.html

    If not, perhaps you could iterate through the table object using a traditional for loop with index counter and check if TableRow myrow == looprow (they are the same object). If so, Table.removeRow at that index.

    Still, it sounds like it would be nice to have Table.removeRow(TableRow row) as part of the official library....

Sign In or Register to comment.