Block: EntityDataStore

A EntityDataStore block for configuring a store in which a list of data entities can be saved.

Overview

An EntityDataStore block is used for configuring a data store that can contain a list of data entities that share the same properties. The properties property defines the entity properties. This set of properties is typically referred to as the “schema” for the data store. This block is not visible in the user interface and should therefore not be included in the areas of the frame layout. A data entity store is often linked to an EntityTable block that displays a table of entities. In the entity data store, entities can be marked as being “selected”. This allows certain actions to be performed on a selected entity in the data store. For example, clicking an “Edit” button may allow the selected entity to be displayed for editing. An entity data store can be made persistent by setting the persistToStore property. Doing so saves the data to a database in the cloud. Any data in the data store is then be saved, even when user logs out or the browser window is closed. This allows data to be persisted across different sessions over time. For example, a solution can be configured that allows a user login and save their project settings and setup.

When persisting data, care must be taken when changing the data schema:

  • If additional properties are added, then the existing entities receive a null value for those properties.
  • If existing properties are removed, then the existing entities have properties that are not part of the schema.

Example

Below is an example configuration. Example of a non-persistent entity data store.

kind: Solution
version: v0
router:
  kind: Router
  routes:
    - frame: home-frame
frames:
  home-frame:
    kind: Frame
    contents:
      my-entity-data-store:
        kind: EntityDataStore
        properties:
          my-prop-a:
            type: Number
          my-prop-b:
            type: String
        entities:
          - my-prop-a: 123
            my-prop-b: Hello
          - my-prop-a: 456
            my-prop-b: World

Example of a persistent entity data store.

kind: Solution
version: v0
router:
  kind: Router
  routes:
    - frame: home-frame
frames:
  home-frame:
    kind: Frame
    contents:
      my-persistent-entity-data-store:
        kind: EntityDataStore
        persistToStore: my-store-name
        properties:
          my-prop-a:
            type: Number
          my-prop-b:
            type: String

EntityDataStoreConfig

PersistedEntityDataStoreConfig

Name Type Required Description
kind "EntityDataStore" Yes
persistToStore string Yes
properties Dictionary<string, PrimitiveEntityProperty> Yes Define the schema of the entities. For every entry key there must be a matching property
subscribe List<EntityDataStoreSubscribe> No A list of objects for subscribing the EntityDataStore block to other blocks.

PrimitiveEntityProperty

Name Type Required Description
type "String" | "Number" Yes Entities values must have a predefined type.

LocalEntityDataStoreConfig

Name Type Required Description
kind "EntityDataStore" Yes
properties Dictionary<string, EntityProperty> Yes Define the schema of the entities. For every entry key there must be a matching property
entities StaticEntities | ImportedEntities Yes Define entities as static records or load entities from a csv file. Entities should match the schema defined by properties
subscribe List<EntityDataStoreSubscribe> No A list of objects for subscribing the EntityDataStore block to other blocks.

StaticEntities

EntityProperty

Name Type Required Description
type "String" | "Number" | "Image" | "AutoId" Yes Entities values must have a predefined type. If type is set to AutoId the value will be autogenerated

ImportedEntities

Name Type Required Description
fromCsvFile string Yes

EntityDataStoreSubscribe

EntityDataStoreControlPanelSubscribe

An object for configuring a subscription from a EntityDataStore block to a ControlPanel block. The subscription allows the entities in the entity data store to be selected and filtered based on the data in the control panel.

Name Type Required Description
kind "ControlPanel" Yes A constant, ControlPanel.
frame string Yes A string specifying the name of the frame in which the ControlPanel is located.
source string Yes A string specifying the name of the ControlPanel.
action "Insert" | "Update" No A constant specifying the action to be performed when the control panel is submitted. Valid options are Insert and Update. - Insert: A new entity is created in the entity data store. - Update: The selected entity in the entity data store is updated.

EntityDataStoreEntityTableSubscribe

An object for configuring a subscription from a EntityDataStore block to a EntityTable block. The subscription allows entities in the entity data store to be selected or deleted by clicking buttons in the entity table.

Name Type Required Description
kind "EntityTable" Yes A constant, EntityTable.
frame string Yes A string specifying the name of the frame in which the EntityTable is located.
source string Yes A string specifying the name of the EntityTable.
selectOn List<string> No A list of strings specifying the names of TableButton columns in the entity table. Clicking a button in a table row results in the corresponding entity in the entity data store becoming selected. Selecting an entity results in previously selected entities becoming unselected.