cti.store‘ object is used to store data which is either required for the app to function or captured by an item in the app. Any data held within this section of the Data Model can be updated/referenced whilst the app is running, and persists when the app is closed and reopened.
When referencing values held in the store, the
cti.store reference is normally shortened to
$store. The exact method used to reference to a value depends on the item where the reference will be used. For more details, please see this documentation.
Within the store there is a wide variety of pre-populated objects which hold/capture data used in the application. Some of the most noteworthy objects include the ones noted below:
Page & Item Data
Each time a new page is added to the app, a new object is registered within the ‘
pages‘ section of the Data Model. The name of this object corresponds to the name of the page, and is used to hold data which relates to items on that page within the app.
When a new item is added to a page, the corresponding object/properties will also be added to the Data Model. These are registered against the ‘Name’ of the item, with the item’s type determining what properties are added to the Data Model.
For example, where an item only stores a single value (e.g. the string entered into a ‘Text’ question), a single property is inserted into the Data Model against the name of the item. Where an item needs to store multiple values (e.g. the ‘choice’ and ‘label’ associated with a ‘Select’ item), the item’s name will be used as an object which holds a property for each required value.
Note that an item will only appear in the model if it is used to store data, and will not appear in the Data Model until any data is recorded against them.
variables‘ section of the store contains a property for each variable which has been added via the App Config screen.
Items which are used to capture media (photos, audio) store their data in a special ‘
media‘ section of the Data Model. An individual item is used for each media-based item, which each containing an ‘images’ or ‘audio’ array with references to the data.
env’ sections contains details of the application’s environment, such as the type of platform used to display the application. This is useful for producing different behaviour based on whether the application is being used on a desktop or mobile device.