Get Column Value from Row

You can retrieve a specific column’s value in a row in a Data Store table using the getColumnValue() method. For example, if you require the value of a single column called ‘product_name’ in a row, you can use this method to obtain that specific value.

You must pass the Column Name of the column as the argument to the getColumnValue()method, as shown in the sample code syntax. You must first fetch an instance of the row as shown below.

The <TABLE_INSTANCE> used in the code below is the instance defined in the Table Instance page.

    
copy
dynamic <ROWINSTANCE>.getColumnValue()

Parameters:

  • id: The The unique ROWID of the particular row that needs to be retrieved

A sample code snippet is shown below:

    
copy
var table = dataStore.getTableInstance(identifier: 'Products'); try{ var (response, table) = await table.getRow(id: 2823000000014176) print("quantity: ${row.getColumnValue("quantity")}") } on ZCatalystException catch (ex) { print("GET ROW FAILED: $ex"); }

Last Updated 2024-11-19 15:44:45 +0530 +0530