Retrieving Captured Data

The Datastore (DS) has a public API which you may use in your application code. This API is most often used to retrieve information from a populated schema but it can also be used to pre-populate a schema. For example, once a client has completed an application, they can submit their information. At this point, the API can be used to extract the data from the schema and populate tables in the relational database.

An example of pre-population is where some information about the client is known in advance of starting their application. If some of that information is required to navigate through the application, the DS can be pre-populated with the information.

To read any data from a schema, the appropriate execution of the script needs to be known. This means you are retrieving the correct application information for a client. Therefore, the executionID and schema name are vitally important to gain access to the data.

The following example code snippet shows the obtaining of the root entity:

Figure 1. Obtaining root entity
final IEGRuntime runtimeAPI = new IEGRuntime();
final IEGRootEntityID rootEntityID =
  runtimeAPI.getScriptExecutionRootEntityID(executionID);
        
Datastore ds = DatastoreFactory.newInstance()
  .openDatastore(kSchemaName);
        
final Entity rootEntity =
  ds.readEntity(rootEntityID.entityID));

From here, the root entity can be used to retrieve other entities under this root entity.