Skip to content

Data Sources

Use data sources when a form control needs to load selectable values from static lists, system definitions, scripts, or database queries.

Data sources populate form controls with lists of values. Typical consumers are query and dropdown widgets, but the same pattern can support any control that needs a selectable list.

The source can range from a fixed list of values to a query against relational or XML data.

Data sources support extensible results. In addition to the basic Value and Text attributes, they may incorporate supplementary attributes depending on the specific data source type.

Each data source exposes TextFormat and ValueFormat properties. These use the data templates syntax, which lets you combine multiple source fields into the visible text or stored value.

Example Data Source

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<ListItemDataSource TextFormat="{{Id}} - {{Name}}" ValueFormat="{{Id}}">
    <Items>
        <Item>
            <Id>1</Id>
            <Name>A</Name>
        </Item>
        <Item>
            <Id>2</Id>
            <Name>B</Name>
        </Item>
    </Items>
</ListItemDataSource>

In this example, the data source provides a list of items that will render as 1 - A and 2 - B when used within a dropdown control.

Mappings

Data sources can include mappings that define how the data source's results are utilized within a form. These mappings are specified within the <Mappings> element and facilitate the association of data source results with form controls.

The following example illustrates how to map the Amount property from a data source to a form control:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<ListItemDataSource TextFormat="{{Id}} - {{Name}}" ValueFormat="{{Id}}">
    <Mappings>
        <Mapping Source="Amount" Target="Amount"/>
    </Mappings>
    <Items>
        <Item>
            <Id>1</Id>
            <Name>A</Name>
            <Amount>3</Amount>
        </Item>
        <Item>
            <Id>2</Id>
            <Name>B</Name>
            <Amount>8</Amount>
        </Item>
    </Items>
</ListItemDataSource>

In this configuration, the Amount property from the selected data source item is mapped to the Amount element in the data model. When an item is selected, the mapped value is written to the target control automatically.

The following data source types are supported:

Simple Data Sources

These data sources are static and do not require any external data source.

ListItemDataSource

This data source returns a static list of values.

System Integration Data Sources

These data sources are used to retrieve definitions from the Emakin system, thus facilitating integration.

ChannelDataSource

This data source returns a list of available team channels, which can be useful for allowing users to select a channel for specific cases.

SecurityProfileDataSource

This data source returns a list of available security profiles, enabling the selection of an Access Control List (ACL) security profile for assigning ACLs to entities such as documents.

ScheduleDataSource

This data source returns a list of available schedules, which can be used to select a calendar schedule for time-based operations.

ContentTypeDataSource

This data source returns a list of available content types, which can be used for dynamically rendering a content type.

Dynamic Data Sources

Dynamic data sources are employed to fetch data from external sources dynamically. The fetched data may vary based on query parameters or other conditions.

TableDataSource

This data source executes a relational database query and returns the result as a list of values.

XmlQueryDataSource

This data source executes an XQuery expression on an XML database and returns the result as a list of values.

XmlDataSource

This data source executes an XPath expression on the current data model and returns the result as a list of values.

ScriptDataSource

This data source executes a script and returns the result as a list of values.

WebServiceDataSource

This data source executes a web service call and returns the result as a list of values.