BuildQuery

Description

Creates and returns a new QueryDef object for the specified record type.

You can use the returned QueryDef object to build a query for searching records whose record type matches the specified EntityDef. Before you can perform the search, you must add at least one field to the query's display list by calling the BuildField method of the QueryDef object. You can also add filters to the QueryDef object to specify the search criteria. For more information on specifying this information, see the description and methods of the Objet QueryDef.

The name you specify in the entitydef_name parameter must correspond to an appropriate record type in the schema. To obtain a list of legal names for entitydef_name, use the GetQueryEntityDefNames method.

Before you can run the query, you must associate the QueryDef object with a Objet ResultSet. See the BuildResultSet method for information on how to do this.

Remarque : The id field must be included as one of the display fields (using the BuildField method of the QueryDef object) for the query to return the complete result set. For Rational ClearQuest Web, you must also include the dbid field as one of the display fields.

Syntaxe

VBScript

session.BuildQuery(entitydef_name) 

Perl

$session->BuildQuery(entitydef_name); 
Identificateur
Description
session
Objet Session représentant la session en cours d'accès à la base de données.
nom_défentité
A String containing the name of the Objet EntityDef to use as a template when creating the record.
Return value
A new Objet QueryDef. This object contains no filters or build fields.

Exemples

VBScript

set sessionObj = GetSession 

' Create a query for "defect" records 
set queryDefObj = sessionObj.BuildQuery("defect") 

Perl

$sessionObj = $entity->GetSession();

# Create a query for "defect" records 
$queryDefObj = $sessionObj->BuildQuery("defect"); 

Commentaires