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 QueryDef Object.

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 ResultSet Object. See the BuildResultSet method for information on how to do this.

Note: 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 HCL Compass Web, you must also include the dbid field as one of the display fields.

Syntax

VBScript


session.BuildQuery(entitydef_name) 

Perl


$session->BuildQuery(entitydef_name); 
Identifier
Description
session
The Session object that represents the current database-access session.
entitydef_name
A String containing the name of the EntityDef Object to use as a template when creating the record.
Return value
A new QueryDef Object. This object contains no filters or build fields.

Examples

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");