Building Apps with Jigx
Data

Datasources

8min

Datasources are sets of data used in Jigx solutions and are used to reference data from the various Data Providers.

Types

There are three types of datasources available in Jigx Builder.

  1. SQLite - Using the SQLite datasource provides the ability to write SQL queries to get data from Dynamic Data and local data providers. For code examples and snippets, see sqlite.
  2. Static - Static lists are typically used when data needs to be accessed but hardly ever changed. Static Data is helpful because it can be created quickly inside the jig, and there is no need to specify any database connections or set up tables. The amount of records that can be created in Static data is unlimited. Static data is commonly used to bind data to the UI components. For code examples and snippets, see Static.
  3. System - The system datasource is used to get a list of icons for jig components. For code examples and snippets, see system.

Configuration options

Property

Description

Code Examples

isDocument

When the isDocument property is set to true on a datasource, the datasource will return as a single record (object) to be displayed on a component instead of an array. The first matching row becomes the datasource without wrapping the array. If there is no match it is NULL.

jsonProperties

Working with complex objects can be tricky, as they include arrays, nested objects, and other complex data structures. When integrating and manipulating these JSON structures you can use jsonProperties to specify the exact property in the array or nested object that you require. See Working with complex REST structures.

isDocument example

datasource


jsonProperties example

YAML
Complex JSON


Where and how to use datasources

In a Global file

Datasources are defined once and are available throughout your solution to be reused in multiple jigs. Adding a global datasource improves performance as the data is retrieved once rather than multiple times.

Global datasource
Global datasource

  1. Open your solution in Jigx Builder and navigate to the datasources folder of your solution.
  2. Create a new file called <your_datasource_name>.jigx.
  3. Invoke IntelliSense (ctrl+space) for the list of available datasources.
  4. Select the datasource you want to use and configure the properties with values. When choosing Dynamic Dataor SQL data, you can write SQL queries to return the data you want to use in the solution.
  5. Next, open the jigs where you want to use the data, use expressions with the datasource option to reference the global datasource file, for example, =@ctx.datasources.employee.

Local within a jig

The data sets are defined in the datasources inside the individual jig generally under the datasources: property. Use datasources locally if you only need the data in that specific jig.

Local datasource
Local datasource

  1. Open your solution in Jigx Builder and navigate to the jig.
  2. Under the datasources: property, replaces the mydata: property with a unique name for the data set.
  3. Invoke IntelliSense (ctrl+space) next to the mydata: property for the list of available datasources.
  4. Select the datasource you want to use and configure the properties with values. When choosing Dynamic Dataor SQL data, you can write SQL queries to return the data you want to use in the jig. Tip: only return the specific data you need in the datasource.
  5. The data is now available to use in that jig by using expressions with the datasource option to reference the local datasource using the unique name you gave it, for example, =@ctx.datasources.contact.

See Also



Updated 07 Nov 2024
Doc contributor
Did this page help you?
Yes
No