BuildField

Description

Selects a field to include in the query's search results.

Before you run a query, you must specify at least one field to display in the search results summary. You must call this method once to specify each field that you want to display. The ResultSet object displays the fields from left to right in the order in which you added them to the QueryDef object. In other words, each time you call this method, you add the specified field to the end of the list; you cannot change this ordering.

Because you associate a QueryDef object with an EntityDef object when you call the BuildQuery method, the field_name parameter must contain the name of a valid field in that EntityDef object. To obtain valid values for the field_name argument, you can query the EntityDef object by calling its GetFieldDefNames method.

You can call BuildField either before or after constructing the query expression (the tree of filter nodes).

Syntax

VBScript


querydef.BuildField field_name

Perl


$querydef->BuildField(field_name);
Identifier
Description
querydef
A QueryDef object.
field_name
A String identifying a valid field of the associated EntityDef object.
Return value
None.

Example

VBScript

' Create a query for defect where id = SAMPL00000001
Dim session
Set session = CreateObject("CLEARQUEST.SESSION")
session.UserLogon "admin", "", "SAMPL", AD_PRIVATE_SESSION, ""

 Set QueryDef = session.BuildQuery("defect")
 QueryDef.BuildField ("headline")
 QueryDef.BuildField ("id")

 Set filternode1 = QueryDef.BuildFilterOperator (AD_BOOL_OP_AND)
 filterNode1.BuildFilter "id", AD_COMP_OP_EQ, "SAMPL00000001"
 Set rsltset = session.BuildResultSet(QueryDef)
 rsltset.Execute

 Status = rsltset.MoveNext

Perl

$queryDef = $CQSession->BuildQuery("Defect");

@dbfields = ("ID","State","Headline");

foreach $field (@dbfields) {
      $queryDef->BuildField($field);
      }