Accessing report content
Use the actuate.report subclasses to access report content that is displayed in the viewer. For example, use the actuate.report.Table subclass to manipulate a specific table on a report. To manipulate a specific text element in a report, use the actuate.Viewer.Text subclass. Use viewer.getCurrentPageContent( ) to access specific subclasses of actuate.report as shown in the following code:
var myTable= myViewer.getCurrentPageContent( ).getTableByBookmark("mytable");
Identify report elements by their bookmarks. Set bookmarks in the report design. The viewer subclasses access specific report elements and can change how they are displayed. To hide a particular data column in the table, use code similar to the following function as the callback function after submitting the viewer:
function hideColumn( ){
var myTable= myViewer.getCurrentPageContent().getTableByBookmark("mytable");
if ( myTable) {
  myTable.hideColumn("PRODUCTCODE");
  myTable.submit( );
  }
}
Hiding the column PRODUCTCODE suppresses the display of the column from the report while keeping the column in the report. Elements that use the PRODUCTCODE column from mytable retain normal access to PRODUCTCODE information and continue to process operations that use PRODUCTCODE information.
Accessing HTML5 Chart features
HTML5 Charts are accessed from the viewer using actuate.viewer.getCurrentPageContent( ).getChartByBookmark( ) like other report charts. To access HTML5 Chart features, use the actuate.report.HTML5Chart.ClientChart object to handle the chart. For example, to access the HTML5 Chart with the HTML5ChartBookmark, use the following code:
var bchart = this.getViewer().getCurrentPageContent()
.getChartByBookmark("HTML5ChartBookmark");
var clientChart = bchart.getClientChart();
ClientChart provides access to ClientOptions, which can change chart features. For example, to change an HTML5 chart title to Annual Report, use the following code:
clientChart.getClientOptions().setTitle('Annual Report');;
clientChart.redraw();
Using a filter
Apply a data filter to data or elements in a report, such as a charts or tables, to extract specific subsets of data. For example, the callback function to view only the rows in a table with the CITY value of NYC, uses code similar to the following function:
function filterCity(pagecontents){
var myTable = pagecontents.getTableByBookmark("bookmark");
 
var filters = new Array( );
var city_filter = new actuate.data.Filter("CITY", actuate.data.Filter.EQ, "NYC");
filters.push(city_filter);
 
myTable.setFilters(filters);
myTable.submit(nextStepCallback);
}
In this example, the operator constant actuate.data.filter.EQ indicates an equals (=) operator.
Using a sorter
A data sorter can sort rows in a report table or cross tab based on a specific data column. For example, to sort the rows in a table in descending order by quantity ordered, use code similar to the following function as the callback function after submitting the viewer:
function sortTable( ){
var btable = this.getViewer( ).getCurrentPageContent( ).getTableByBookmark("TableBookmark");
 
var sorter = new actuate.data.Sorter("QUANTITYORDERED", false);
var sorters = new Array( );
sorters.push(sorter);
 
btable.setSorters(sorters);
btable.submit( );
}
The first line of sortTable( ) uses the this keyword to access the container that contains this code. Use the this keyword when embedding code in a report or report element. The this keyword doesn’t provide reliable access to the current viewer when called directly from a web page.

Additional Links:

Copyright Actuate Corporation 2012