Actuate JavaScript API classes : Class actuate.data.Request

Class actuate.data.Request

Description

Specifies a request for retrieving data and the conditions for that request. This class provides the scope for a request by defining a target element and a range of rows. The scope of the request determines what goes into a ResultSet. Functions that use request can only retrieve ResultSets from report elements that have an explicit bookmark.

Constructor

Syntax

actuate.data.Request(string bookmark, integer startRow, integer maxRow)

Constructs a Request object that other classes use to retrieve data.

Parameters

bookmark

String. A bookmark that identifies an Actuate report element. The actuate.data.Request object uses the bookmark to identify the report element to request information from. If null, Request uses the first bookmark. Functions that use request can only retrieve ResultSets from report elements that have an explicit bookmark.

startRow

Integer. The numerical index of the requested first row. The smallest valid value is 1.

maxRow

Integer. The numerical index of the requested last row. The smallest valid value is 1.

Function summary

Table 4-12 lists actuate.data.Request functions.

actuate.data.Request.getBookmark

Syntax

string Request.getBookmarkName( )

Returns the bookmark name for this request.

Returns

String. The bookmark used in the Request object’s constructor.

Example

This example retrieves the bookmark that was used when the specified Request object was instantiated.

return myRequest.getBookmarkName( );

actuate.data.Request.getColumns

Syntax

string[ ] Request.getColumns( )

Returns a list of column names that match the request.

Returns

Array of strings. The column names.

Example

This example retrieves the first, third, and fifth column names from the request object myRequest.

function get135Columns(myRequest){
  var columns = myRequest.getColumns( );
  return columns[0];
  return columns[2];
  return columns[4];
}

actuate.data.Request.getFilters

Syntax

actuate.data.Filter[ ] Request.getfilters( )

Returns filters set for this request.

Returns

Array of actuate.data.Filter objects.

actuate.data.Request.getMaxRows

Syntax

integer Request.getMaxRows( )

Returns the index of the last row as an integer.

Returns

Integer. The maxRow value used in the Request object’s constructor.

actuate.data.Request.getSorters

Syntax

actuate.data.Sorter[ ] Request.getSorters( )

Returns sorters defined in this data condition.

Returns

Array of actuate.data.Sorter objects.

actuate.data.Request.getStartRow

Syntax

Integer Request.getStartRow( )

Returns the index of the starting row as an integer.

Returns

Integer. The startRow value used in the Request object’s constructor.

actuate.data.Request.setBookmark

Syntax

void Request.setBookmark(string bookmark)

Sets the bookmark.

Parameters

bookmark

String. The name of a bookmark.

Example

This example sets the bookmark for the myRequest object to the string myRequestStart.

function setMyRequestBookmark(myRequest){
  myRequest.setBookmark("myRequestStart");
}

actuate.data.Request.setColumns

Syntax

void Request.setColumns(string[ ] columns)

Sets the columns of data to request.

Parameters

columns

An array of strings designating the columns of requested data. Use an array for this argument, even if there is only one value.

actuate.data.Request.setFilters

Syntax

void Request.setFilters(actuate.data.Filter[ ] filters)

Adds filters to a request. Filters further refine the set of data provided by a request. Using setFilter removes the previous filters from the Request object. All of the filters set in a request are applied when the request is used.

Parameters

filters

An array of actuate.data.Filter objects or a single actuate.data.Filter object to refine the request. Use an array for this argument, even if there is only one value.

actuate.data.Request.setMaxRows

Syntax

void Request.setMaxRows(integer maxrow)

Sets the last row to request.

Parameters

maxrow

Integer. The numerical value of the index for the last row to request. The minimum value is 1.

Example

This example sets the index of the last row for the myRequest request object to 50.

myRequest.setMaxRows(50);

actuate.data.Request.setSorters

Syntax

void Request.setSorts(actuate.data.Sorter[ ] sorters)

Adds sorters to a request to sort the set of data that a request provides. Sorting the data increases the effectiveness of requests by providing the data in a relevant order. Using setSorters removes the previous sorter objects from the request object. All of the sorters set in a request are applied when the request is used.

Sorters are applied in the order that they occur in the array. For example, if the first sorter specifies sorting on a state column and the second sorter specifies sorting on a city column, the result set is sorted by city within each state.

Parameters

sorters

An array of actuate.data.Sorter objects or a single actuate.data.Sorter object to sort the result of the request. Use an array for this argument, even if there is only one value.

Example

This example sets the alphaNumericSorterSet array in myRequest.

myRequest.setSorters(alphaNumericSorterSet);

actuate.data.Request.setStartRow

Syntax

void Request.setStartRow(integer startrow)

Sets the requested first row.

Parameters

startrow

Integer. The numerical value of the index for the first row to request. The minimum value is 1.

Example

This example sets the index of the first row for the myRequest request object to 10.

myRequest.setStartRow(10);

(c) Copyright Actuate Corporation 2011