Walkthrough: Designing the Sub-Query
The following example illustrates how to use a sub-query to get a list of values from an XML data stream and then using the query result in the condition of another query to retrieve a list of employees. The query retrieves a list of all employees with evaluation scores above a score of 3.
Walkthrough
First, create a query to retrieve the employee ID's of employees with scores above a certain value.
1. Create a query, “Scores”, using the 'Personnel' data source.
2. Select the 'default' request type.
3. On the Fields tab, select the 'id' field, and click the 'add' button.
4. On the Condition tab, select the 'score' field, click the 'add' button, and set the condition to:
score >= $(score)
5. Click 'Finish'.
Notice that the 'Map to Table' option is selected. It would not be necessary to map the result to a table if the return value was a child node. In this case, however, you need to return the employee ID, which is an attribute in the employee record. Attributes can only be returned as a table column.
This query returns a table with a single column, the employee ID. The score comparison is done against the 'Score' variable.

| << Invoking a Sub-Query | © 1996-2013 InetSoft Technology Corporation (v11.5) | Walkthrough: Designing the Main Query >> |