BuildFilterOperator

Description

Creates a nested QueryFilterNode Object that contains the specified Boolean operator.

This method creates a nested node (or subnode) in the query expression. The newly created node operates at the same level as the filters in the QueryFilterNode object specified in the node parameter and is subject to the same conditions. You can add filters to the newly created node using the BuildFilter method just as you would for any other node.

Syntax

VBScript


node.BuildFilterOperator bool_operator 

Perl


$node->BuildFilterOperator(bool_operator); 
Identifier
Description
node
The QueryFilterNode object to which the newly created node will be attached.
bool_operator
A Long whose value is one of the BoolOp enumeration constants.
Return value
The newly created QueryFilterNode object.

Examples

VBScript


' query for (id in idRange) AND (submitter = jjones OR clopez OR kwong)

Set qdef = sessionObj.BuildQuery("Defect")

qdef.BuildField ("id")

qdef.BuildField ("headline")

'Here is the root operator

Set filterNode1 = qdef.BuildFilterOperator(AD_BOOL_OP_AND)

Dim idRange(1) ' This sets up an array of two elements 
 
idRange(0) = "SAMPL00000055"

idRange(1) = "SAMPL00000057"

filterNode1.BuildFilter "id", AD_COMP_OP_IN, idRange

'Here is the subnode operator

Set filterNode2 = filterNode1.BuildFilterOperator(AD_BOOL_OP_OR)

filterNode2.BuildFilter "submitter", AD_COMP_OP_EQ, "jjones"

filterNode2.BuildFilter "submitter", AD_COMP_OP_EQ, "clopez"

filterNode2.BuildFilter "submitter", AD_COMP_OP_EQ, "kwong" 

Perl

# query for (Owner = jsmith) AND (state = closed)
@owner = ("jsmith");

@state = ("closed");

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

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

foreach $field (@dbfields) {

      $queryDef->BuildField($field);   

      }

$FilterNode1 = $queryDef->BuildFilterOperator($CQPerlExt::CQ_BOOL_OP_AND);

$FilterNode1->BuildFilter("Owner", $CQPerlExt::CQ_COMP_OP_EQ, \@owner);

$FilterNode1->BuildFilter("State", $CQPerlExt::CQ_COMP_OP_NOT_IN, \@state);



$resultSet = $CQsession->BuildResultSet($queryDef);

$resultSet->Execute;

$num_columns = $resultSet->GetNumberOfColumns;