Recursive queries
Example 1
To retrieve a list of all employees who work for Jane Smith in the Seattle office:
- Set up the appropriate recursive query on the Employee form, which contains hierarchical information about relationships between employees and managers.
- In the levelsToRetrieve element, specify 0 to search all levels in the hierarchy.
- In the recursion qualifier, the value in the City field on the Location form for each employee must be Seattle.
The recursive query finds 35 employees who work for Jane: Two reporting directly and 33 reporting either to her direct reports or to subordinates of her direct reports. Only 12 of those employees, however, work in the Seattle office, so the query returns only 12 records.
Example 2
The following C and Java examples show how to use a recursive query to find all employees who either report directly to Bob Jones or who report to his direct reports:
The query retrieves the root or parent level (startQual) and two levels below the root.
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*