You are browsing the documentation for iTop 3.0 which is not the current version.

Consider browsing to iTop 3.1 documentation

Known issues and limitations

New since 2.3.0: New constrains on OQL formatting due to Request optimization:

If the user has Allowed organizations defined, then this query will fail for him

SELECT l FROM Organization AS child 
JOIN Organization AS root ON child.parent_id BELOW root.id 
JOIN Location AS l ON l.org_id = child.id

Use instead

SELECT Location AS l 
JOIN Organization AS child ON l.org_id = child.id 
JOIN Organization AS root ON child.parent_id BELOW root.id

The operator ! is not accepted.

The equivalent of !ISNULL(start_date) can be expressed ISNULL(start_date) != 1

true and false are not accepted,

  • use 1 instead of true
  • use !=1 instead of false

null is not accepted, use instead the function ISNULL(attribute)

External Keys are never NULL, when undefined they are set to 0

If you have an attribute which can be null, for example an enumeration with possible values: 'yes', 'no'

 SELECT MyClass WHERE enum != 'yes' 

is equivalent to

 SELECT MyClass WHERE enum = 'no' 

as SQL does not consider that null is different from 'yes'
In that case don't forget to explicitly request the null

 SELECT MyClass WHERE enum != 'yes' OR ISNULL(enum)

LIKE

The syntax for LIKE is LIKE “%abc%”.

To escape a character, you have to prefix the character by \.
For example :

SELECT Contact WHERE name LIKE "%d\"a%"

The _ and % in the MySQL Like statement have special meanings, as documented in the MySQL documentation :

  • _ to match any single character
  • % to match an arbitrary number of characters (including zero characters)

If you need to search for those characters, in SQL you would escape them with a single \ character, but in OQL you have to prefix them with \\.
For example :

SELECT VirtualMachine WHERE name LIKE "%with\\_undescore%"
SELECT VirtualMachine WHERE name LIKE "%100\\% total%"

LIMIT, ORDER, GROUPBY, COUNT, SUM

Currently OQL does not support LIMIT, ORDER, GROUPBY, COUNT, SUM, and many other functions
3_0_0/oql/oql_limitations.txt · Last modified: 2022/01/21 16:52 (external edit)
Back to top
Contact us