webCOMAND

cQL UPDATE Statements

UPDATE statements modify existing repository objects, and are similar to an SQL UPDATE statement.

  • UPDATE and APPROVE will modify the active version of objects of specified content type(s).
  • SAVE will create a new draft of objects, instead of modifying the active version. 
  • STORE will update working copies, instead of creating a draft or modifying the active version.

The following clauses are all optional and may appear in any order.

  • SET - Precedes a comma-separated list of Key=Value pairs where the Key is a dot-notation field relative to the content getting updated and value is a query expression.  As an alternative, a comma-separated list of just Keys can be provided, followed by a VALUES clause.
  • IN - Restricts updates to objects located in a folder or field, specified by a cPath.
  • WHERE - Specifies the filter to apply to the specified content type(s).
  • WITH - Restricts updates to objects of one or more dimensions.
  • SELECT - Specifies which fields and calculated values to return for each updated object.

UPDATE

Update the active version of objects of the specified content type(s).  Specify multiple content types as a comma-separated list.  A '+' can also follow the content type to also include any content types that extend it.  Outstanding object drafts and working copies will remain.  For example:

UPDATE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123

Like SQL UPDATE, VALUES can be used to specify the values after defining what fields to set.  For example:

UPDATE Contact SET Name, Phone.Number VALUES('Jenny', '867-5329') WHERE OID=123

APPROVE

An alias for UPDATE that is consistent with the name used in the Apps and API.  For example:

APPROVE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123

SAVE

Similar to UPDATE, except modifications are made to a new object draft, and the active version of the objects are not updated.  For example:

SAVE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123

STORE

Similar to UPDATE, except modifications are made to the working copy, and the active version of the objects are not updated.  For example:

STORE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123

SET

The SET clause is similar to the SQL equivalent, except dot-notation fields may be specified to set "deep" content.

UPDATE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123

IN

Optional cPath to restrict updates to objects located in a folder or field, specified by a cPath.

UPDATE Contact SET Name='Jenny' IN /Example/Folder

WHERE

Specifies the filter to apply to the specified content type(s).

UPDATE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123

WITH

Restricts updates to the specific versions of an object based on dimension value(s).  A single dimension value may be specifed (ie. WITH EN) or multiple, including wildcards (ie. WITH EN,ES,*).  If multiple are specified, only the best match will be updated.

UPDATE Contact SET Name='Jenny' WHERE OID=123 WITH EN

SELECT

Specifies which fields and calculated values to return for each updated object, same as in a SELECT Statement.

UPDATE Contact SET Name='Jenny' WHERE OID=123 SELECT OID, Name