Get Rows

Note: Ensure you have installed the required package to use this SDK method.

Get a Single Row

You can use the getRow() SDK method to fetch a single row from a table in the Catalyst Data Store. The table reference used in the below code snippets can either be a table instance or a table meta.

copy
const datastore = new Datastore();
const table = datastore.table('ShipmentDetails');
//Use the table instance or the table meta object to fetch a row by passing the Row ID 
const rowPromise = table.getRow(1510000000109476);

Example of Expected Response

copy
{
  "CREATORID": "2136000000006003",
  "MODIFIEDTIME": "2021-08-17 13:02:11:184",
  "CREATEDTIME": "2021-08-16 16:29:10:499",
  "CityName": "Chennai",
  "ROWID": "2136000000011011"
}

Get All Rows Through Pagination

You can use the get the required rows of data from a table in the Data Store in a paginated fashion using the getMyPagedRows() SDK method. You can refer to the required table using its ID.

The table reference used in the below code snippets can either be a table instance or a table meta.

Info: Getting the rows in a paginated manner allows you to fetch the rows of a table in batches or pages through iteration.

Parameters Used

Parameter Name Data Type Definition
hasNext Added Will determine if the next iteration is required to fetch more rows.
maxRows Int An optional parameter. Will return the required number of rows per page based on the value you set. For example, if you set the value of maxRows as 100, then 100 rows of data will be per page.

Info: By default, without using the maxRows parameter, the SDK method will return 200 rows per page.
nextToken String Will be used to decide if more rows need to be fetched from the table.
more_records Needed Will be fetched from the response data to fetch the next set of records.



copy
const datastore = new Datastore();
// Fetch rows through pagination and declare the value for nextToken as undefined for the first iteration
async function getMyPagedRows(hasNext = true, nextToken = undefined) {
  if (!hasNext) {
    return;
  }
  const { data, next_token, more_records } = await dataStore.table(195000000042025).getPagedRows({ nextToken, maxRows: 100 });
  console.log("rows:", data); // Fetch the rows from the table
  return getMyPagedRows(more_records, next_token); // Fetch next set of records
}

Example of Expected Response

The following type of response can be expected is the value for more_records is set as true.

copy

{ “status”: 200, “data”: [ { “CREATORID”: “3359000000006003”, “MODIFIEDTIME”: “2022-01-11 18:18:24:855”, “name”: “Alex Jones”, “CREATEDTIME”: “2022-01-11 18:18:24:855”, “ROWID”: “3359000000108111” }, { “CREATORID”: “3359000000006003”, “MODIFIEDTIME”: “2022-01-11 18:18:25:117”, “name”: “Robert Neal”, “CREATEDTIME”: “2022-01-11 18:18:25:117”, “ROWID”: “3359000000108114” }, { “CREATORID”: “3359000000006003”, “MODIFIEDTIME”: “2022-01-11 18:18:25:120”, “name”: “Roslyn Gunn”, “CREATEDTIME”: “2022-01-11 18:18:25:120”, “ROWID”: “3359000000108117” } ], “message”: “OK”, “more_records”: true, “next_token”: “{{token}}” }

The following type of response can be expected is the value for more_records is set as false.

copy

{ “status”: 200, “data”: [ { “CREATORID”: “3359000000006003”, “MODIFIEDTIME”: “2022-01-11 18:18:43:556”, “name”: “Alex Jones”, “CREATEDTIME”: “2022-01-11 18:18:43:556”, “ROWID”: “3359000000108410” }, { “CREATORID”: “3359000000006003”, “MODIFIEDTIME”: “2022-01-11 18:18:43:557”, “name”: “Robert Neal”, “CREATEDTIME”: “2022-01-11 18:18:43:557”, “ROWID”: “3359000000108413” }, { “CREATORID”: “3359000000006003”, “MODIFIEDTIME”: “2022-01-11 18:18:43:568”, “name”: “Roslyn Gunn”, “CREATEDTIME”: “2022-01-11 18:18:43:568”, “ROWID”: “3359000000108417” } ], “message”: “OK”, “more_records”: false }

Last Updated 2026-07-02 14:51:41 +0530 IST