Data Paths

How to Identify the Exact Data you want to bind

A data path is a string which identifies the specific data you want. Data paths are central to data-binding, to identify the data we want bound.

You can think of it like a file, or a URL.

In it most extensive form, it can have 4 or more segments;

$Data Source Type.Data Source Name.Object ID..Field Name

At a minimum, a data path typically includes a Data Source Type and a Field Name.

e.g.; $cookie.my-cookie

In more complex Data Sources, additional segments are needed, for example;

$db.my-db.my-object.my-field

In this example;

  • $db indicates that the Data Source Type is a database. SA5 will resolve this by doing a lookup in the Datastore.

  • my-db is the Data Source Name, which will be registered in the Datastore. For a CMS data source this would typically be the CMS collection slug, or similar.

  • my-record is a unique object ID, for Keyed Data Sources. You can think of this as a database record. For a CMS data source this would typically be the CMS item slug.

  • my-field is the field on that object that we want, e.g. a CMS item field.

Currently, Data Paths always identify a single point value, which can be bound to a single-value item such as a text element, an input field, a {{ macro }} expansion, etc. However in the future, it may also be used to retrieve full objects or even object-sets for list-binding and table-binding operations.

Examples;

Data Source Type

$user.name

User object

Name value

$user.data.custom-url

User object

Custom user

@name

User object

$cookie.foo

Cookie

The cookie named foo

$local.bar

Local storage

$session.bat

Session storage

$query.foo

Query string

$db.my-db.my-record.my-field

Database

Last updated