Actuate JavaScript API classes : Class actuate.data.ResultSet

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.(request, parseRS)
function parseRS(resultset){
// do stuff with resultset
}

Function summary

Table 4-13 lists actuate.data.ResultSet functions.

actuate.data.ResultSet.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];
}

actuate.data.ResultSet.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.

Parameters

columnIndex

Integer. The numerical index of the column from which to retrieve data.

Returns

String.

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);

actuate.data.ResultSet.next

Syntax

boolean next( )

The next( ) function 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( );
  }
}

(c) Copyright Actuate Corporation 2011