Create a New Table Instance

You can create a table instance for a particular table in the Data Store, and enable the methods defined in this class to access the instance object. This prevents unnecessary server calls.

A table instance can be created by calling the getTableInstance() method in either of the two ways mentioned below.

The <DATA_STORE_INSTANCE> used in both the methods is the instance defined in the Data Store Instance page.

Create a Table Instance by its ID

You can create a table instance by passing the particular table ID as the argument to the getTableInstance() method, as shown in the code syntax below:

    
copy
<DATA_STORE_INSTANCE>.getTableInstance( String id )

Parameters:

  • id: The unique table ID of the specific table the instance needs to be created for

A sample code snippet is shown below:

    
copy
val table = ZCatalystApp.getInstance().getDataStoreInstance().getTableInstance("2823000000017011")

Create a Table Instance by its Name

Alternatively, you can create a table instance by passing the particular table’s name as the argument to the getTableInstance() method, as shown in the code syntax below:

    
copy
<DATA_STORE_INSTANCE>.getTableInstance( String identifier )

Parameters:

  • identifier: The name of the specific table the instance needs to be created for

A sample code snippet is shown below:

    
copy
var table = ZCatalystApp.getInstance().getDataStoreInstance().getTableInstance(identifier: "Products");

Last Updated 2023-09-03 01:06:41 +0530 +0530