UDB Query Expressions (Advanced)
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 |
O(123, 456, 789) | Multiple starting IDs |
O() | Object function |
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 items in a list). |
O(#COID).P() | Go to the parent object of the current object. |
O(#COID).C(^RI=1234) | Go to the Children of the current 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 |
^RI | 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 denotes the selection order
O(308).C(:^C1 like 'A%') | Return all Children of object 308 where character field 1 starts with the letter A. |
O(308).C(::^C1) | Return all Children of object 308 in character field 1 order. |
O(308).C(:^ID in (3154,3577,3162,3165):^C1) | 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.
^C1 | Primary object field |
^C2 | Secondary Object Field |
^TX | Object Text Data |
^ID | Object ID |