cQL APPROVE, SAVE and STORE Statements
APPROVE, SAVE and STORE modify existing objects in the repository. UPDATE and APPROVE are similar to an SQL UPDATE statement. They modify the active version of an object. SAVE is similar, except a new object draft is created, instead of modifying the active version. STORE also is similar, except the working copy is updated, instead of creating a draft or modifying the active version.
The following clauses are all optional and may appear in any order, except UPDATE, APPROVE, SAVE or STORE must appear somewhere in the statement.
- APPROVE | SAVE | STORE - Specifies which fields and calculated values to return for each resulting object or row.
- 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.
APPROVE
Approve modifications to the active version of the object. Outstanding object drafts and working copies will remain. For example:
APPROVE Contact SET Name='Jenny', Phone.Number='867-5329'WHERE OID=123
UPDATE is an alias for APPROVE, to be SQL friendly and comparable. For example:
UPDATE Contact SET Name='Jenny', Phone.Number='867-5329' WHERE OID=123
Like SQL UPDATE, VALUES can be used to set the values after defining what fields to set. For example:
UPDATE Contact SET Name, Phone.Number VALUES('Jenny', '867-5329') WHERE OID=123
SAVE
Similar to APPROVE, 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 APPROVE, 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