Using Dynamic Data
Once you have created the Dynamic Data tables as well as, columns and data records the data can be used in multiple places in a solution.
Dynamic Data can be:
Protected - add Row Level Security (RLS) through security policies and authorization. For more information, see Row Level Security, Data policies and Authorized users.
Created - create new records in Dynamic Data tables, for example, adding new employees. For code examples and snippets, see Creating Dynamic Data.
Read - Read the data to populate a form, list, show a location and more. For code examples and snippets, see Reading Dynamic Data.
Updated -update existing records in Dynamic Data tables, for example, updating an employee's address. For code examples and snippets, see Updating Dynamic Data.
Deleted - delete existing records in Dynamic Data tables, for example, remove old contacts or out-of-stock products. For code examples and snippets, see Deleting Dynamic Data.
As a datasource
The Dynamic Data provider is used in Jigx Builder in the SQLite datasource either inside a single jig (locally) or under the datasources folder structure (global), allowing the data to be called once and reused throughout the solution in multiple jigs. Write SQLite queries to return the exact data you need to work with.
# Use the sqlite datasource with the dynamic data provider.
type: "datasource.sqlite"
options:
provider: DATA_PROVIDER_DYNAMIC
entities:
- entity: default/employee
# Write sqlite query syntax to return data needed in the jig/solution.
query: |
SELECT
id,
'$.firstname',
'$.lastname',
'$.photo',
'$.birthdate',
'$.gender',
'$.email',
'$.phone',
'$.street',
'$.city',
'$.state',
'$.country',
'$.category',
'$.modify'
FROM [default/employees] WHERE '$.category' = "employee-detail"In components
Once you have created the datasource.sqlite with the Dynamic Data provider as shown above, the data is referenced in components using Expressions, such as [email protected]
children:
- type: component.form
options:
children:
- type: component.dropdown
instanceId: dropdown-in
options:
# use an expression to reference the dynamic data datasource to use
# in the form.
data: [email protected]
label: Select employees
isSearchable: true
item:
type: component.dropdown-item
instanceId: [email protected]
options:
# use an expression to reference the exact data entry to use
# in the drop-down component on the form.
value: [email protected]
title: [email protected]
subtitle: [email protected]
leftElement:
element: avatar
text: ""
uri: [email protected]In actions
Execution actions are designed to interact with specifically with data. The following actions can be used with the Dynamic Data provider either to create, update, delete, or sync data.
sync-entities for getting data to the device.
Events actions execute after an event is performed by a user or device. This event can be configured to use the Dynamic Data provider, for example, when refreshing a list jigby pulling down (onRefresh) use the action.sync-entities with the provider to refresh the data in the list. The following event actions are available.
onRefresh
onFocus
onPress
onLoad (only on index.jigx)
onChange
onDelete
onButtonPress (only on calendar jigs)
For the complete list and code examples of available actions, see actions.
Examples and code snippets
The following examples with code snippets are provided:
Last updated
Was this helpful?