How to Associate Aggregated Queries

This topic explains how to associate aggregated queries so that the results from data sources in an aggregated query can be used as input data for a second, completely independent aggregated query (see figure below). In other words, when there are two or more aggregated queries and the results of one can be used as search parameters for the other, these queries can be associated, allowing users to easily browse from one query to the other.

 

 

For instance, if a query to view the social security numbers of the employees of an organization was created, and another, separate query was created to view their criminal records (including their social security numbers), these two queries can be associated so that the user can easily view both of the related items. More than one parameter can also be used in the associated queries, so that if an aggregated query contains data sources with the SSN and the driver’s license of employees and another aggregated query contains information on traffic violations from three different data sources that contain the employees’ SSN, driver’s license, and SSN and driver’s license, respectively, only the results that contain both parameters (SSN and driver’s license) will be displayed. A PDF report can then be generated for each entry from the results, listing all the results from the associated queries that are related to the entry selected. For more information on how to generate reports for aggregated queries, see Chapter 15: Integration -> Aggregated Queries -> Run Aggregated Queries -> How to Run an Aggregated Query.

When configured correctly, the associated queries will be displayed in a list of options below the entry for the item in the results of the query (see figure below). This feature will generate a breadcrumb at the top of the page showing the trail of associated aggregated queries that were executed, so that you can easily go back to the previously executed queries.

 

 

Relationships between queries are defined when adding a data source to an aggregated query, by including the QueryLinks set:

<DataSource ID="dataSource1">

    <QueryLinks>

       <Link TargetID="iq2" Text="Link to aggregated query iq2">

          <Parameter ResponseFieldName="name" SendAsInputID="complete_name" />

       </Link>

    </QueryLinks>

</DataSource>

 

Each association is registered using a Link element, which must contain two required attributes:

    TargetID: Indicates the identifier of the target aggregated query.

    Text: Defines the text to be used to represent this relationship in the interface.

 

Parameter elements are used to register each value that will be passed from the result of the query to the target aggregated query, and must contain two required attributes:

    ResponseFieldName: Indicates the value to be sent in the JSON of the result in the query.

    SendAsInputID: Defines the identifier of the input field in the target aggregated query.