Skip to content

Query

The Query widget retrieves data from specified data sources and populates the data model with the results.

Data Model Mapping

The TargetXPath property determines where the query results are written in the data model.

  • Sequence Target: If the target XPath points to a sequence-type element, each row from the query results creates a new node within that sequence.
  • Single Node Target: If the target XPath points to a single node, the existing data at that location is cleared before the query results are written.

Filter Panel

A filter panel allows defining query parameters. These parameters are mapped to data model elements and passed to the data source to filter results.

  • AutoSearch: Controls whether the query executes automatically when filter values change (true) or requires manual execution via a search button (false).
  • ShowFilter: Controls the visibility of the filter panel. Set to false to hide the panel.

Result Selection

  • AutoSelectAll: If true, all query results are automatically added to the data model. If false, a modal dialog is displayed, allowing the user to select specific rows to add.

Data Clearing

  • ClearFirst: If true, the target data model element is cleared before populating with query results. If false, results are appended.

Rules Engine Integration

The Query widget supports rules:

  • Formatting Rules: When a formatting rule disables the widget, the widget is hidden, and the data model is not populated.
  • Validation Rules: Validation rules are executed when the search button is clicked. Failed validation prevents query execution and displays an error message.

Data Sources

The Query widget can utilize multiple data sources, combining results into a single result set. See Data Sources for details.

Column Templates

Column templates customize the display of query results. Each template maps to a specific query column; matching columns have their content rendered using the specified template.

Column Template Example

1
2
3
<ColumnTemplate Caption="Foto">
    <Content><![CDATA[<img style="height:50px" src="https://remote/product/{{Id}}/photo.jpg" />]]></Content>
</ColumnTemplate>

This template replaces the "Foto" column's content with an image whose source is dynamically generated based on the Id column value.

Row Scripting

A row script allows executing custom JavaScript code for each row in the query results. This script receives the current row ($Row) and the new child node to be added to the data model ($NewChild) as parameters.

Examples

Example 1: Basic Query

1
2
3
4
5
<Query AutoSearch="false" AutoSelectAll="false" ShowFilter="true" ClearFirst="false" ValidationGroup="">
    <TargetXPath><![CDATA[List/User]]></TargetXPath>
    <Filter></Filter>
    <DataSources></DataSources>
</Query>

Example 2: Filter Panel

1
2
3
4
<Query AutoSearch="false" AutoSelectAll="false" ShowFilter="true" ClearFirst="false" ValidationGroup="" XPath="" SectionName="" HtmlClass="">
    <TargetXPath><![CDATA[List/User]]></TargetXPath>
    <Filter>...</Filter>
</Query>

Example 3: Column Templates

1
2
3
4
<Query AutoSearch="false" AutoSelectAll="false" ShowFilter="true" ClearFirst="false" ValidationGroup="" XPath="" SectionName="" HtmlClass="">
    <TargetXPath><![CDATA[List/User]]></TargetXPath>
    <ColumnTemplates>...</ColumnTemplates>
</Query>