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( id: Long ): ZCatalystTable

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) //Replace this with your Table ID

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( identifier: String ): ZCatalystTable

Parameters:

  • identifier: The name 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("EmployeeDetails") //Replace this with your table name

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