This documentation supports the 18.05 version of Remedy Action Request System.

To view the latest version, select the version from the Product version menu.

Recursive queries

Recursive queries retrieve information from forms that store hierarchical (parent-child) data. For example, a Bill of Materials form might contain information about the relationship between assemblies, their subassemblies, the subassemblies' subassemblies, and so on.

The ARMultiSchemaFuncQueryFromList structure of the ARGetListEntryWithMultiSchemaFields function represents a list of items that are included in the FROM clause of the query generated by the function. The items can include multiple forms (schemas) and one recursive query.

The ARMultiSchemaRecursiveFuncQueryStruct structure represents the recursive query. You can return hierarchical data from only one form. Specify that form in the structure's queryFromList parameter, and then give it an alias (recursiveSchemaAlias). To specify the hierarchical node or nodes to begin the recursion on, use the start with qualifier (*startQual). To apply conditions from other forms during the recursion, add those forms to the recursion qualifier (*recursionQual).

For example, 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, specify that 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.

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.

Note

For recursive queries, set the sortList parameter to NULL.

Was this page helpful? Yes No Submitting... Thank you

Comments