AddUniqueKey

Description

Adds the unique key field of the primary record type of this query to the QueryFieldDefs object.

Creates and adds to the collection a QueryFieldDef object that makes up a unique key field. This field is a concatenation, into a single string, of all the fields that make up a unique key (if there are more than one). For example, if you have a unique key of first-name + last-name, this would generate SQL like (syntax varies by vendor):


select concat(first_name, last_name) from defect.

You would get back a single result column with values like "Joe Jones".

Note: The method adds the DBID field to the query and marks that field to be converted into the unique key for the record when the query is run. The QueryFieldDef returned from the AddUniqueKey method appears as if only the DBID field is selected, but the ResultSet produced by executing the query returns the record's display name as the column value. For stateless records, the display name is formed by joining each unique key field with a separating space.

Syntax

VBScript


queryfielddefs.AddUniqueKey 

Perl


$queryfielddefs->AddUniqueKey(); 
Identifier
Description
queryfielddefs
A QueryFieldDefs collection object, representing the set of QueryFieldDef objects available for fetching as a collection.
Return value
Returns the QueryFieldDef object.