Query Builder Query

<< Click to Display Table of Contents >>

Navigation:  Using Cimera > Searching and Querying > Structured Queries >

Query Builder Query

Previous pageReturn to chapter overviewNext page

The Query Builder uses simple or complex criteria to find items in the Cimera Database.

 

The CQL Query window can be launched by selecting Menu Query > New Query (Query Builder) or by selecting to create a new Query Builder Query from the Manage Queries window

 

Query - Builds

 

Item Type

 

Select the Item Type you wish to search.  The Item Type selected will determine which attributes are available to specify criteria against.

Some Item Types are Inherited by other Item Types (see Item Type Inheritance), if the selected Item Type is inherited then all its descendant Item Types are also searched.

 

For example select Item Type "Computer" to search all "Desktops", "Laptops" and "Servers"

 

If an Item Type is not creatable (see Item Type Inheritance) then it will appear in italics.

 

Items

 

If the Item Type selected is not versionable then the Items option will always be selected (see Versions)

 

Items or Versions

 

If the Item Type selected is versionable then there will be an Items or Versions option.

Select whether you are searching for Versions or the Item Stems of Versions.

 

If Items is selected then only the Stem attributes will be available.

If Versions is selected then the attributes of both the Item Stem and the Version will be available to specify criteria against.

 

If Stem fields are selected then if an Item Stem meets the criteria then all its versions will be included.
If Version fields are selected then all Versions that meet the criteria, irrespective of the Stem, will be included
If both Stem and Version fields are selected then the Versions will only be included if their Stem meets the Stem criteria and the Version meets the Version criteria.

 

Clear

 

Remove all criteria

 

Query Syntax

 

The Cimera Query Builder uses a kind of polish notation (or prefix notation) to specify the criteria, much as how Excel formulas are written i.e. the operator is specified BEFORE the operands it applies to, and not in between them.

 

For example

 instead of a sum being written as 1+2+3 it would be specified as +1 2 3

 

 the expression

         reference=123 AND (colour=green OR day=Monday OR Status=Closed)

 

 would be expressed as

         AND        reference=123 OR (colour=green, day=Monday, Status=Closed)

 

 or with different formatting

         AND        reference=123

                 OR        colour=green

                         day=Monday

                         Status=Closed

 

 

Boolean Expressions

 

The Query Builder only uses the boolean operators AND, OR, NOT so expressions are in the format:

 

BooleanOperator (condition1, condition2, condition3,…)

 

Where "condition" returns either TRUE or FALSE

 

For example

 

AND (2>1 , 3>4 , 6>5)        returns FALSE

OR (2>1 , 3>4)        returns TRUE

 

AND (Condition1, Condition2, OR (Condition3, Condition4, Condition5))

returns TRUE if Conditions 1 and 2 are both TRUE and at least one of Conditions 3, 4 or 5 are TRUE

 

AND (9>8, OR (2>1 , 3>4) , 6>5)        returns TRUE

 

 

 

Building the Query

 

There are 3 main parts to an expression

 AND

 OR

 Condition

 

 

Add AND

 

Create a new boolean AND statement (See Boolean Expressions below).

This option is only available if an "OR" statement is high lighted (it makes no logical sense in any other context)

 

 

Add OR

 

Create a new boolean OR statement (See Boolean Expressions below).

This option is only available if an "AND" statement is high lighted (it makes no logical sense in any other context)

 

 

Add Condition

 

Create a new condition for the parent AND or OR statement (See Boolean Expressions below)

 

This will bring up the Add Condition window which will allow the user to select

 

1.the field they wish to test
2.the condition
3.the value to compare it against.

 

The latter 2 are customised depending on the Attribute Type of the field selected.

 

 

NOT

 

Negate the selected condition.

For example if you wanted the Items with Names that did not start with an "a" then set the condition to be "Name starts with a" and then negate it.

 

 

Remove

 

Delete the selected boolean condition

 

Note

 

The Query Builder Window only searches the Cimera Databases, it does not search the Item Library which holds file attachments.

It also does not search long text attributes: the History and Text attributes (See Attribute Types)

 

See Also

CQL Query

Reporting DB Query