List Comparison for Queries using Hierarchical Meta Data

The syntax and grammar of the query condition expression is covered in Appendix Appendix A:, Hierarchical Query Condition Expression Syntax. The following is an example.

If you want to get a list of all employees with C++ programming skill, you can add a condition to the employee node to select only people with C++ on their skill list. However, since each employee may have multiple skills linked in the employee record, a simple string comparison does not give the correct result.

skill = 'C++ programming'

This condition would work if all employees only had one skill listed. If the C++ programming were listed as the second skill of an employee, the comparison would return false because a list of skills is converted to a scalar value by using the value of the first child.

You need an expression to compare the skill list with a value, and the comparison should be true if any value on the list matches the skill. The following list comparison expression returns the correct result.

'C++ programming' = any skill

Walkthrough

Next, use this feature to create a query to retrieve all C++ programmers from the employee database.

1. Create an XML query as before, with the name “C++ Programmers”.

2. Select the 'Employee' node and click on 'Select Record' to make it the selection tree path.

3. Enter the condition expression in the condition text area:

'C++ programming' = ANY skill

4. Select 'Save' (on the main toolbar) to save the expression.

5. Select the 'Map to Table' option, then click 'Preview'.

 

<< Walkthrough: Designing the Main Query © 1996-2013 InetSoft Technology Corporation (v11.4) List Pattern Matching for Queries using Hierarchical Meta Data >>