Saves the query to the specified location in the workspace.
The user logged into the current session must have access to the pathname specified in the qdefPath parameter. (Thus, only users with administrative privileges can save queries to the Public Queries folder.) If the pathname you specify in the qdefPath parameter contains subfolders that do not exist, Rational ClearQuest creates those folders implicitly.
The last parameter to the SaveQueryDef method is a Boolean value that specifies whether or not to overwrite an existing QueryDef object with the same name and path (0 = no overwrite, 1 = overwrite). The method returns an error if the query already exists, with either a 0 or 1 value specified for the overwrite parameter.
VBScript
workspace.SaveQueryDef qdefName, qdefPath, queryDef, overwrite
Perl
$workspace->SaveQueryDef(qdefName, qdefPath, queryDef, overwrite);
Perl
use CQPerlExt;
my $CQSession = CQSession::Build();
my $RootFolder = "Public Queries";
$CQSession->UserLogon($ologon, $opw, $odb, "");
$workspace = $CQSession->GetWorkSpace();
$QueryDef = $CQSession->BuildQuery("Defect");
@owner = ("jswift");
@state = ("Closed");
@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();
$workspace->SaveQueryDef("delete me", $RootFolder, $QueryDef, 1);
print "'$RootFolder/delete me' copied\n";
}
CQSession::Unbuild($CQSession);