webCOMAND

Paths & Queries

This tutorial builds on the Content Types and Import/Export tutorials to show how to locate and query objects in the repository.

Paths (cPath)

Similar to how a file path addresses a file in a file system, a cPath addresses an object in the repository.

There are a number of places cPath can be used throughout webCOMAND:

  • Title Bar - Click the "Edit cPath" option () on the right side of the title bar to reveal the cPath.
    Title Bar cPath
  • Collection Bar Search - Use cPath filters in the collection search to further filter the collection of objects in the current view.
  • COMAND Console - Query repository objects from cPath query tabs.

cPath is also used in a number of other ways, but those will be covered in other tutorials.

Single Object cPath

A simple cPath is similar to a file path with slash-separated folders and final filename, except the final element is an object key instead of a filename.  For example, since the Tutorials folder contains Presidents, which have a Unique/Key Number field, we can address the first president with:

/Tutorials/1
If an object key contains spaces or other non-alphanumeric characters, it must be surrounded by single- or double-quotes.

Collection (Multiple Objects) cPath

In addition to referencing a single object, a cPath can also reference a collection of objects.

To reference a collection of all objects in a folder, simply leave off the final object key.  For example, to reference all objects in the Tutorials folder:

/Tutorials

A cPath can also reference objects with a "filter", which can use criteria besides a folder.  Filters specify criteria in square brackets.  For example, to show all President objects:

[:President]

The square brackets specify a filter, the colon indicates a following Content Type Identifier.

In addition to filtering by content type, any field criteria can be specified.  For example, to show all President objects with "John" as their first name:

[:President AND Name LIKE 'John %']

Folders and filters can be combined to retrieve only content in a folder that matches the filter:

/Tutorials/[:President AND Name LIKE 'John %']

A more comprehensive reference is available in the cPath Documentation.

Queries (cQL)

Similar to how SQL is used to query a database, cQL is used to query a COMAND repository.

For example, a collection of all Presidents, no matter what folder they are in (including no folder at all), can be retrieved with:

SELECT * FROM President

In cQL, all clauses are optional though, so the SELECT * can be dropped when it is not needed:

FROM President

To restrict results based on certain criteria, use a WHERE clause, similar to SQL:

FROM President WHERE Number>=12 AND Number<=24

To limit results to objects in a specific folder, use the IN clause:

FROM President IN /Tutorials

ORDER BY and LIMIT can be added to a query, similar to SQL:

FROM President IN /Tutorials ORDER BY Number DESC LIMIT 12

A more comprehensive reference is available in the cQL Documentation.

cPath & cQL

cQL can be appended to any cPath in curly braces.  This is useful for taking advantage of features of cQL that are not available in cPath.  For example, adding an ORDER BY or LIMIT clause.

/Tutorials/[:President]{ORDER BY Number LIMIT 1}
Since cQL can be appended to cPath when surrounded by curly braces, it can appear alone in curly braces anywhere cPath is accepted.  For example, {FROM President} will work anywhere cPath will work.