Accessing report content
Use the subclasses to access report content that is displayed in the viewer. For example, use the 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 as shown in the following code:
var myTable= myViewer.getCurrentPageContent( )
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.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 object to handle the chart. For example, to access the HTML5 chart with the HTML5ChartBookmark, use the following code:
var bchart = this.getViewer().getCurrentPageContent()
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');;
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"CITY",, "NYC");
In this example, the operator constant 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( )
var sorter = new"QUANTITYORDERED", false);
var sorters = new Array( );
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.