Class actuate.data.ResultSet
Description
The actuate.data.ResultSet class represents the data retrieved from a report document. The functions in the actuate.data.ResultSet class access the data by row. The actuate.data.ResultSet class keeps an internal reference to the current row and increments the current row with next( ).
Constructor
There is no public constructor for actuate.data.ResultSet. The actuate.DataService.downloadResultSet and actuate.Viewer.downloadResultSet functions instantiate the ResultSet object. Set the reference to the ResultSet object in the callback function. For example, when the result set is used as the input parameter for the callback function, result becomes the label for the ResultSet, as shown below:
viewer.downloadResultSet(request, parseRS)
function parseRS(resultset){
// do something with resultset
}
Function summary
Table 7‑14 lists actuate.data.ResultSet functions.
Table 7‑14 actuate.data.ResultSet functions
Function
Description
Returns the column names
Returns the data by the given column index
next( )
Increments the current row
getColumnNames
Syntax
string[ ] Request.getColumnNames( )
Returns a list of column names.
Returns
Array of strings. The column names.
Example
This example retrieves the first, third, and fifth column names from the ResultSet object myResult:
function get135Columns(myResult){
var columns = myResult.getColumns( );
return columns[0];
return columns[2];
return columns[4];
}
getValue
Syntax
string ResultSet.getValue(integer columnIndex)
Returns the value of the specified column from the current row. Specify the column by its numerical index. Use next( ) before using getValue( ) to set the cursor to the first record.
Parameter
columnIndex
Integer. The numerical index of the column from which to retrieve data.
Returns
String. The field value.
Example
This example returns the value for the column with an index value of 4 from the current row in the ResultSet object myResult:
return myResult.getValue(4);
next
Syntax
boolean next( )
Increments the current row for the ResultSet. When no current row is set, next( ) sets the current row to the first row in the ResultSet. When no next row exists, next( ) returns false.
Returns
Boolean. True indicates a successful row increment. False indicates that there are no further rows.
Example
This example returns the value for the column with an index value of 4 from all of the rows in the ResultSet object myResult:
function getColumn4Rows(myResult){
var nextrow = myResult.next( );
while (nextrow){
return myResult.getValue(4);
nextrow = myResult.next( );
}
}