Accessing single rows with JavaScript

Hello dear Seatable experts,

It is possible to access relations to another table in a simple manner, like

const rows = base.getRows('Table1', 'Default')
for(const row of rows) {
  // get id of referenced row in other table
  const relation_id = row.relation[0]

However to then look at this related entry, there is missing a method that would “get row by id” or similar, so you need to iterate over the referenced table until the correct referenced row is encountered:

const rows_related = base.getRows('Table2', 'Default')
for(const row_related of rows_related) {
  if(row_related._id == relation_id) {
    // do things

Maybe I am missing something here, but it would be great to have a method that could work like:

const row_related = base.getRow(relation_id)

(I suppose working with the globally unique row id would not even require to specify the table?)


getRowById is available:

Base - SeaTable Scripts Programming Manual

1 Like

:heart_eyes: wonderful, thanks!