Skip to content

Table Data Source

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

The table data source query supports data templates expressions that bind to the data model. When the associated data model is modified, the data source query is automatically updated.

Example

In this example, the data source retrieves a list of cost type categories from the ExpenseManagement.CostTypeCategories table. The Name column is designated as the text value, while the Code column is used as the underlying value.

The query filters the results based on the Name column using the Like comparison operator. Since the criteria value is {{search}}*, the query will return all records where the Name column begins with the value of the search data model element. When the search data model element's value is changed, the query is automatically refreshed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<TableDataSource TextFormat="{{Name}}" ValueFormat="{{Code}}" Enabled="True">
    <Mappings/>
    <Query>
        <Parameters>
            <TargetSchema Type="System.String"><![CDATA[ExpenseManagement]]></TargetSchema>
            <TargetTable Type="System.String"><![CDATA[CostTypeCategories]]></TargetTable>
        </Parameters>
        <Columns>
            <Column Name="Code"/>
            <Column Name="Name"/>
        </Columns>
        <Where Condition="And">
            <Criteria>
                <Criteria Expression="Name" Comparison="Like">
                    <Value>{{search}}*</Value>
                </Criteria>
            </Criteria>
            <Blocks/>
        </Where>
        <Order>
            <Order Expression="Name" Type="Ascending"/>
        </Order>
    </Query>
</TableDataSource>