This topic explains how to customize the template used for displaying the results of aggregated queries. There are two ways of defining how this data will be presented on the screen:
• Default display: If the configuration of the data source (not its association with the aggregated query) contains the OutputFields set with values defined for it, the default display can be used. In this case, a customized display template does not have to be configured.
• Customized template: Custom templates are used when, for example, the results of a query to a data source returns a URL to an image or a link to an external site. A template can be customized to display an image with an HTML IMG tag and to create a link with an HTML A tag, for example.
If neither of these two methods is used, the results of the query will be an error. If the two are present, the customized template will have precedence.
Customized templates are defined in a Template element when adding a data source to an aggregated query:
<DataSource ID="dataSource1">
<Template>
<p>{{description}}</p>
<a href=”{{link_url}}”>{{link_description}}</a><br />
<img src=”{{image_src}}” />
</Template>
</DataSource>
Internally, the system uses the Handlebars template to transform the template into the final HTML to be rendered in the browser. This template will be executed once for each item in the results of the query. For details on handlebars, see the full documentation at http://handlebarsjs.com/.