UDB has a custom query language that can be used in numerous places to reference either individual objects or lists of objects via multiple routes.

Starting point

Every Query needs a place to start. This might be a particular object, the current object, or the current page.

O(308) Start at object id 308. In this case, a list of countries.
O(#COID) Start at the current object.
O(#POID) Start at the current Page ID

There is also a shorthand version of the above where you can start the query simply by placing the object id in brackets such as (308), (#COID) or (#POID).

O() Object function
^I Object ID

Defining the relationship

Once you have a starting point, you usually need to go on to related objects

O(308).C() Return all Children of object 308 (all the countries).
O(#COID).P() Go to the parent object of the current object.
O(#POID).C(^T=1234) Go to the Child object of the current page object via relationship 1234.

In the first two examples the relationship type was not specified.
In this case, it defaults to 0, the system id for a default object parent/child relationship.

C() Child function
P() Parent function
^T Relationship Type ID

Parent and Child functions

The Parent and child functions have three parameters separated by colons ":".

relationship condition : object condition : order

  • The first parameter defines the relationship
  • The second parameter validates the destination object
  • The third parameter demotes the selection order
O(308).C(:^C like 'A%') Return all Children of object 308 where the primary field starts with the letter A.
O(308).C(::^C) Return all Children of object 308 in primary field order.
O(308).C(:^I in (3154,3577,3162,3165):^C) Return all Children of object 308 with the specified ID's in primary field order.

Using an order parameter in lower case "^c" tells the query to sort in descending order.

^C Primary object field
^H Secondary Object Field
^X Object Text Data