ExecuteAndSave

Description

Executes a query and saves the result set as a file.

Note: This method became available in version 7.1.

Syntax

VBScript

resultset.ExecuteAndSave fileName, delimiter, options 

Perl

$resultset->ExecuteAndSave($fileName, $delimiter, $options); 

Identifier
Description
resultset
A ResultSet object, representing the rows and columns of data resulting from a query.
fileName
A String that specifies the file pathname for the result set to be exported to.
delimiter
A String that specifies the delimiter to use for the result set rows to be exported to the file.
options
A String that specifies optional requirements for saving files. This argument can be a series of Key=Value pairs separated by semicolons. For example, using the value INCLUDE_HEADER=1 includes the header of column names in the file like this: $resultset->ExecuteAndSave("C:\\myqueryfile.csv", ",", "INCLUDE_HEADER=1");
Return value
None.

Example

Perl

 # limit a ResultSet to 10000 rows
 my $CQWorkSpace = $CQSession->GetWorkSpace();
 my $qry = $CQWorkSpace->GetQueryDef("Public Queries/Some Big Query");
 my $ResultSet = $CQSession->BuildResultSet($qry);
 my $options = "INCLUDE_HEADER=1";
 $ResultSet->SetMaxResultSetRows(10000);
# Creates a tab delimited file and replaces the file if it already exists.
$ResultSet->ExecuteAndSave ("c:\\temp\\mybigquery.txt", "\t", $options);