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 physical mailing address, or a URL.
Examples
Simple Data Paths
A simple data path typically consists of a Data Source Type and a Data Source Name.
e.g.;
$query.foo
Query string
The value of the query string param named foo
$cookie.foo
Cookie
The value of the cookie named foo
$local.bar
Local storage
The value of the localStorage string with key bar
$session.bat
Session storage
The value of the sessionStorage string with key bat
Complex Data Paths
Complex Data Paths involve referencing arrays ( typically collection lists ) or values within an object.
e.g.;
$user.name
User object
The User's name
$user.data.custom-url
User object
The User's custom attribute named custom-url
$db.my-db.my-record.my-field
Database
Describes a more complex referencing within an SA5 Data "Database".
Database Data Paths
SA5's Database concept is being revisited based on use case feedback.
SA5 typically structures and references values using a named object array.
e.g.
Here we have;
$db
indicates the Data Source Typedb-name
is the Data Source Name, indicating which database, by nameobject-id
is the specific named object, within the array. In an SA5 Database constructed from a Collection List, this is typically the slug of the item.( optional path ) within a complex object, you may need a path to navigate to the item
field-name
the name of the item you wish to bind to
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.
Last updated
Was this helpful?