The "update" command. Transacted content revision modification from tabular text files

over 4 years ago

The syntax of the command is

update typeName 

[{set propertyName1 = value, propertyName2 = value, ...
where {{ attached-label = "labelName" } | { query = "myquery" }
          | propertyName relation value and/or propertyName relation value and/or...}
          {{for} {folder = 'myfolder' {recurse} or folder = 'myfolderhierarchy' {recurse} or folder = . {recurse} or ...}}  


{ (propertyName1, propertyName2, . . .  ) } from "pathToFileName" { join propertyName }]

{ separator ‘fieldSeparator’} {pattern "pattern"}}

{output* | {propertyName,...} | filter='myFilter' into "outputFilePath"

[–epwdfile “pathToPasswordFile”]

[-p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"]

All StarTeam types are supported for update, including custom components. The file type is supported as well, for all modifiable properties. However, file content cannot be updated using the update command.

There are two variations to the syntax of this command, both forms executing in an 'atomic' transaction.

The inline form of the command uses the set syntax and describes the assignment of values to different modifiable properties (keys), where the items (whose revisions are to be updated) are identified by the conditions associated with the where clause. (see the select command).

The other (mutually exclusive) form of the command reads property values from a file. The properties to be updated are identified in the command syntax. The values are read from a file, each row representing 1 item, each column positionally matching values to property names.

At least one property in the property value set must be the key to identify the item to be updated. The key may be implicitly defined, such as a known, unique, read only property like ViewMemberID, or the primary descriptor of the type. If the implicit approach is used, the key must be the first column of each row of the file. A preferable approach is to explicitly define the key using the join syntax.

The property ViewMemberID is a special read-only property that uniquely identifies any item of a given type in a view. It can be obtained from the select command, and can be used in the update command as a natural key for join's.

Note: All elements in the grammar are required as is, including commas and/or double-quotes where specified. The only caveat to this is the | and { } notations, which are used to indicate optional components of the syntax. 

e.g. join changenumber would imply that changenumber is to be used as the key to find the items to be updated, but this requires the changenumber property to be one of the columns in the input file.

The following example sets the synopsis to the value foo for all change requests with an Open status.

update changerequest set synopsis = "foo" where query = "Status = Open"

The following example will update the set of all change requests in the file crsForUpdate.txt,
properties as specified in the comma separated list, values in the file spread across several lines, 1 per
change request, order of the values matching the order of the properties in the command syntax.

update ChangeRequest (ChangeNumber, Synopsis, usr_SomeText, Component) from c:\temp\crsForUpdate.txt separator ,

A special null value is recognized as an allowed value of an Enumerated Property This permits the syntax

update ChangeRequest set status = null where status = New -p "user:pwd@host:port/project/view"

update ChangeRequest set status = New where status = null -p "user:pwd@host:port/project/view"


How To-Best Practice
Comment List
Related Discussions