Data Sources (beta)
Data sources functionality is in beta testing and may be subject to change.
The data source is an attribute of a list field. It allows using collection field values as list field options.
We have a collection of player names called "Team" and want to use names from this collection as available values for a list field named "Captain".
Here is how "Team" and "Captain" fields may be specified in project settings JSON.
{
"sections": [
{
"name": "Data Sources",
"properties": [
{
"label": "Team",
"key": "team",
"field": "base_collection"
}
]
},
{
"name": "Fields",
"properties": [
{
"label": "Captain"
"key": "captain",
"field": "player_name_selector"
}
]
}
]
}
[
{
"key": "text",
"type": "freetext",
"localisable": false
},
{
"key": "base_collection",
"type": "collection",
"fieldset": [
{
"key":"name",
"field": "text",
"label": "Name"
}
]
},
{
"key": "player_name_selector",
"type": "list",
"data": [],
"source": {
"field": "$$PROJECT_FIELDS.team",
"value_key": "name"
}
}
]
The
source
object in player_name_selector
specifies to use "Team" collection as a data source.
$$PROJECT_FIELDS.team
from source.field
is an absolute path to the "Team" collection.Attribute
source.value_key
specifies that the field name
in the "Team" collection is used to build values for the list.- If the field definition has a
source
attribute then thedata
attribute must have an empty array as a value -"data": []
.
Last modified 1mo ago