Identifying Records by Item Name

You can identify SBM records by name. All Primary and Auxiliary tables and many system tables have a column corresponding to record name. System tables without such a column do not have a meaningful name concept and their records are considered to have a name of empty string. Though record name uniqueness is not enforced, many SBM installations use unique names for certain record types, such as projects. For those record types, a script may want to look up a record by name. Record names are often supplied as Shell properties and sometimes appear as object method parameters or return values.

For system tables (tables without variable fields), the name column is always called TS_NAME. Some system tables, such as the TS_RECORDLOCKS table, do not have a TS_NAME column, because they are internal objects. In those tables, all record name values are considered to be empty string.

For Primary and Auxiliary tables, the name column has a database name of TS_TITLE that corresponds to a variable field defined in the TS_FIELDS table. Every Primary or Auxiliary table has a minimum set of "system fields" required for basic SBM operations, and these system fields have positive numbers in the TS_SYSCODE column of the TS_FIELDS table. The record name is one such system field, having a TS_SYSCODE value of 4.

A list of syscode values can be found in the SBM schema document available through http://www.serena.com/support.

To find the column corresponding to a record's name in a Primary or Auxiliary table, locate the row of the TS_FIELDS table with a TS_SYSCODE of 4 and TS_TABLEID matching the desired table's ID. That row corresponds to the table's record name field. That row's TS_DBNAME value is the database name of the given table's record name column. That row's TS_NAME value is the display name of the given table's record name column. Note that the database name of this column never changes and can thus be hard coded in SQL statements. The display name may be changed at any time by the SBM administrator.

Related Topics

Working with SBM Database Records

Identifying Records by TS_ID and Table ID