Class actuate.XTabAnalyzer
Description
The XTabAnalyzer class represents a Data Analyzer viewer, used to view and operate a crosstab.
Constructor
Syntax
actuate.XTabAnalyzer( )
Constructs a new Data Analyzer object.
actuate.XTabAnalyzer(object xtabContainer, actuate.xtabanalyzer.UIOptions uiOptions)
actuate.XTabAnalyzer(string xtabContainerId, actuate.xtabanalyzer.UIOptions uiOptions)
Constructs a new Data Analyzer object in the specified container.
Parameters
xtabContainer
Object. A document object referencing the HTML <div> element that contains the xTabAnalyzer viewer.
xtabContainerId
String. The value of the ID parameter for an HTML <div> element to hold the xTabAnalyzer viewer. For example, with 'containerName' as the xtabContainer parameter, a <DIV ID='containerName' /> tag on the page displays the viewer at the location of the <div> element.
uiOptions
actuate.xtabanalyzer.UIOptions object. Optional. UIOptions references display options for the viewer.
Function summary
Table 5-2 lists actuate.XTabAnalyzer functions.
Returns the actuate.xtabanalyzer.UIOptions object assigned to this viewer
Set callback when the pop-up window is closed
actuate.XTabAnalyzer.commit
Syntax
void XTabAnalyzer.commit(function callback)
Commits all design changes to a generated document as a single operation. If ivMode is not set to true, call setIVMode( ) to set the value of ivMode to true before calling commit( ).
Parameter
callback
Function. The callback function called after commit finishes.
Example
This example opens a design with a cross tab and pivots the cross tab:
function pivot( ){
// make a change to the cross tab.
  crosstab.pivot( );
  crosstab.submit( );
  viewer.commit( );
}
actuate.XTabAnalyzer.forceSoftRestart
Syntax
void XTabAnalyzer.forceSoftRestart( )
Forces the viewer to restart.
Example
This example restarts the viewer:
this.onclick = function(event){
  forceSoftRestart( );
}
actuate.XTabAnalyzer.getCurrentPageContent
Syntax
actuate.xtabanalyzer.PageContent XTabAnalyzer.getCurrentPageContent( )
Returns the Current Page Content object.
Returns
actuate.xtabanalyzer.PageContent object. Content from the current page.
Example
This example retrieves the cross tab from the current page:
function getCrosstab(analyzerViewer){
  var content = analyzerViewer.getCurrentPageContent( );
  return content.getCrosstabByBookmark( );
}
actuate.XTabAnalyzer.getCurrentPageNum
Syntax
integer XTabAnalyzer.getCurrentPageNum( )
Returns the current page number.
Returns
Integer. The current page number.
Example
This example retrieves the page number:
function retrievePageNum( ){
  return analyzerViewer.getCurrentPageNum( );
}
actuate.XTabAnalyzer.getGadgetId
Syntax
string XTabAnalyzer.getGadgetId( )
Returns the gadget ID of the shown cross tab. This function is used for dashboard integration.
Returns
String. A gadget ID.
Example
This example retrieves the gadget ID:
function retrieveGadgetID( ){
  return analyzerViewer.getGadgetId( );
}
actuate.XTabAnalyzer.getHeight
Syntax
integer XTabAnalyzer.getHeight( )
Returns the height of the viewer.
Returns
Integer. The height in pixels.
Example
This example retrieves the current height of the viewer and doubles the height if the current height is lower than 630 pixels:
function doubleHeight( ){
  var height = viewer.getHeight( );
  if (height < 630)  {
    viewer.setHeight(height * 2);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.getLeft
Syntax
integer XTabAnalyzer.getLeft( )
Returns the left margin of the viewer.
Returns
Integer. The left margin in pixels.
Example
This example retrieves the position of the viewer’s left margin and moves the margin 20 pixels to the right if the left margin is fewer than 45 pixels from the left edge of the screen:
function moveLeftMargin( ){
  var left = viewer.getLeft( );
  if (left < 45){
    viewer.setLeft(left + 20);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.getParameterValues
Syntax
actuate.xtabanalyzer.ParameterValue[ ] XTabAnalyzer.getParameterValues( )
Returns the parameter values.
Returns
actuate.xtabanalyzer.ParameterValue[ ] or actuate.parameter.ParameterValue[ ]. An array of parameter values.
actuate.XTabAnalyzer.getPosition
Syntax
string XTabAnalyzer.getPosition( )
Returns the CSS position attribute for the viewer.
Returns
String. The CSS position attribute.
Example
This example changes the CSS positioning type from relative to absolute:
function changePosition( ){
  if (viewer.getPosition( ) == 'relative'){
    viewer.setPosition('absolute');
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.getTop
Syntax
integer XTabAnalyzer.getTop( )
Returns the top margin of the viewer.
Returns  
Integer. The top margin in pixels.
Example
This example retrieves the value for the viewer’s top margin and moves the margin 20 pixels down the screen if the margin was fewer than 45 pixels from the top of the screen:
function moveTopMargin( ){
  var top = viewer.getTop( );
  if (top < 45)  {
    viewer.setTop(top + 20);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.getTotalPageCount
Syntax
integer XTabAnalyzer.getTotalPageCount( )
Returns the total page count.
Returns
Integer. The total number of pages.
Example
This example displays an alert with the total page count from viewer:
alert("Total pages: " + viewer.getTotalPageCount( ));
actuate.XTabAnalyzer.getUIOptions
Syntax
actuate.xtabanalyzer.UIOptions getUIOptions( )
Returns the user interface options object for the cross tab analyzer. The UIOptions object specifies what features are used within the viewer.
Returns
actuate.xtabanalyzer.UIOptions object. Data analyzer user interface options.
Example
This example retrieves the user interface options and sets one of the UIOptions values:
function resetUIOptions( ){
  var options = viewer.getUIOptions( );
  options.enableToolbar(false);
  viewer.setUIOptions(options);
}
actuate.XTabAnalyzer.getViewer
Syntax
static XTabAnalyzer.getViewer(HTMLElement container)
Returns a viewer by container. To retrieve the viewer for the current object, do not specify a container. This function is useful to retrieve the instance ID for a specific viewer when there are multiple viewers on a page.
Parameters
container
HTMLElement. The container instance ID from which to retrieve the viewer.
Returns
XTabAnalyzer object. The Data Analyzer viewer.
Example
This example retrieves the viewer:
function retrieveViewer( ){
  return viewer.getViewer( );
}
actuate.XTabAnalyzer.getWidth
Syntax
string XTabAnalyzer.getWidth( )
Returns the width value of the viewer.
Returns
String. The width in pixels.
Example
This example retrieves the width of the viewer, then alters it based on the size:
function doubleWidth( ){
  var width = viewer.getWidth( );
  if (width < 630){
    viewer.setWidth(width * 2);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.getXTabBookmark
Syntax
string XTabAnalyzer.getXTabBookmark( )
Returns the bookmark name for the cross tab set to render in the viewer.
Returns
String. The bookmark for a cross tab.
Example
This example retrieves the bookmark that the cross tab is associated with, changes the bookmark, and resets the bookmark. This functionality supports the use of multiple cross tab elements within a single design.
function changeBookmark( ){
  var oldBookMark = viewer.getXTabBookmark( );
  viewer.setXTabBookmark("crosstab2");
  viewer.submit( );
}
actuate.XTabAnalyzer.getXTabIid
Syntax
string XTabAnalyzer.getXTabIid( )
Returns the current instance ID of the data analyzer. This function is useful in integration with Interactive Viewer and supports the ability of Interactive Viewer to obtain and use the data analyzer instance ID.
Returns
String. A data analyzer instance ID.
Example
This example retrieves the data analyzer instance ID:
function retrieveXTablid( myviewer ){
  return myviewer.getXTablid( );
}
actuate.XTabAnalyzer.isActive
Syntax
boolean XTabAnalyzer.isActive( )
Returns true when a pop-up containing a data analyzer is active and false in all other cases.
Returns    
Boolean. True indicates an active data analyzer pop-up window.
Example
This example checks if a viewer exists by checking two conditions: the viewer variable exists, or isActive( ) returns true. When both conditions fail, the example code creates a new viewer object within a container:
function checkViewer( ){
  if(!viewer || !viewer.isActive( )){
    viewer = new actuate.XTabAnalyzer(container);  
  }
}
actuate.XTabAnalyzer.isDashboard
Syntax
boolean XTabAnalyzer.isDashboard( )
Returns true when dashboard mode is active and false in all other cases.
Returns    
Boolean. True indicates dashboard mode.
actuate.XTabAnalyzer.isInteractive
Syntax
boolean XTabAnalyzer.isInteractive( )
Returns whether this Data Analyzer is in Interactive mode.
Returns    
Boolean. True indicates dashboard mode.
Example
This example displays whether myDataAnalyzer is interactive:
alert("Interactive mode: " + myDataAnalyzer.isInteractive( ));
actuate.XTabAnalyzer.registerEventHandler
Syntax
void XTabAnalyzer.registerEventHandler(string viewerEvent, function handler)
Registers an event handler for the specified event. This function throws actuate.xtabanalyzer.Exception when invalid arguments are passed.
Parameters  
viewerEvent
String. Specifies the event that triggers the handler call. For a list of supported events, see actuate.xtabanalyzer.EventConstants.
handler
Function. Called when the event occurs.
Example
This example changes an event handler from one function to another:
function changeEventHandler( event ){
  viewer.removeEventHandler(actuate.xtabanalyzer.EventConstants.ON_CONTENT_CHANGED, oldChangedHandler);
  viewer.registerEventHandler(actuate.xtabanalyzer.EventConstants.ON_CONTENT_CHANGED, newChangedHandler);
}
actuate.XTabAnalyzer.removeEventHandler
Syntax
void XTabAnalyzer.removeEventHandler(string viewerEvent, function handler)
Removes an event handler from the specified event. This function throws actuate.xtabanalyzer.Exception when invalid arguments are passed.
Parameters  
viewerEvent
String. Specifies the event from which to remove the event handler. For a list of supported events see actuate.xtabanalyzer.EventConstants.
handler
Function. The function to deregister from the event.
Example
This example changes an event handler from one function to another:
function changeEventHandler( event ){
  viewer.removeEventHandler(actuate.xtabanalyzer.EventConstants.ON_CONTENT_CHANGED, oldChangedHandler);
  viewer.registerEventHandler(actuate.xtabanalyzer.EventConstants.ON_CONTENT_CHANGED, newChangedHandler);
}
actuate.XTabAnalyzer.reset
Syntax
void XTabAnalyzer.reset( )
Resets the viewer to its initial state.
Example
This example resets the viewer. All changes to the viewer made prior to this call are lost:
function resetViewer( ){
  viewer.reset( );
}
actuate.XTabAnalyzer.resizeTo
Syntax
void XTabAnalyzer.resizeTo(integer width, integer height)
Resizes the viewer to the specified height and width.
Parameters  
width
Integer. The width in pixels.
height
Integer. The height in pixels.
Example
This example resizes the viewer when the new width is fewer than 1000 pixels and the new height is fewer than 650 pixels:
function resizeViewer(width,height){
  if ((width < 1000) && (height < 650))  {
    viewer.resizeTo(width,height);
  }
}
actuate.XTabAnalyzer.rollback
Syntax
void XTabAnalyzer.rollback( function callback)
Rolls back all changes in the viewer since the last commit( ) call and refreshes the viewer’s content. The value of ivMode must be true for rollback( ) to function.
Parameter
callback
Function. The callback function called after rollback finishes.
Example
This example rolls back all changes to the viewer made since the last commit or submit function call:
function rollbackViewer( ){
  viewer.rollback( );
}
actuate.XTabAnalyzer.setGadgetId
Syntax
void XTabAnalyzer.setGadgetId(string gadgetId)
Sets the cross tab gadget ID. This function is used for dashboard integration.
Parameters
gadgetId
String. The gadget ID used to render the cross tab.
Example
This example sets the gadget ID:
function setGadgetID(id){
  viewer.setGadgetId(id);
}
actuate.XTabAnalyzer.setHeight
Syntax
void XTabAnalyzer.setHeight(integer height)
Changes the height of the viewer.
Parameters
height
Integer. The height in pixels.
Example
This example retrieves the viewer’s current height. When the current height is fewer than 630 pixels, the example code doubles the viewer’s height.
function doubleHeight( ){
  var height = viewer.getHeight( );
  if (height < 630)  {
    height = height * 2;
    viewer.setHeight(height);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.setIVMode
Syntax
void XTabAnalyzer.setIVMode(boolean ivMode)
Sets IVMode for the viewer. Integrating a Data Analytics viewer with the Interactive Viewer affects the undo/redo feature. When set to true, all changes to the Data Analytics viewer must be committed as one transaction. The Interactive Viewer can undo or redo the entire batch.
Parameters
ivMode
Boolean. Set to true if using IV mode.
Example
This example sets IVMode for the viewer:
function setViewerMode(mode){
  viewer.setIVMode(mode);
}
actuate.XTabAnalyzer.setLeft
Syntax
void XTabAnalyzer.setLeft(integer left)
Sets the position of the viewer’s left margin.
Parameters
left
Integer. The left margin for the viewer in pixels.
Example
This example retrieves the left margin of the viewer and moves the margin 20 pixels to the right when the margin is less than 45 pixels from the edge of the screen:
function moveLeftMargin( ){
  var left = viewer.getLeft( );
  if (left < 45){
    viewer.setLeft(left + 20);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.setOnClosed
Syntax
void XTabAnalyzer.setOnClosed(function callback)
Sets a callback function to call when a viewer pop-up closes.
Parameters  
callback
Function. The function to call when the pop-up closes.
Example
This example checks to see if a pop-up window is active and sets a callback function to trigger when the pop-up closes:
function setPopupCloser( ){
  if(viewer.isActive( )){
    viewer.setOnClosed(closerCallbackFunctionName);
  }
}
actuate.XTabAnalyzer.setPageNum
Syntax
void XTabAnalyzer.sePageNum(function pageNum)
Sets the page number.
Parameters  
pageNum
Integer. The page number.
Example
This example sets the sets the page number to the first page:
function setPageNumberToFirst( ){
  if(viewer.isActive( )){
    viewer.setPageNum(1);
  }
}
actuate.XTabAnalyzer.setPosition
Syntax
void XTabAnalyzer.setPosition(string position)
Sets the CSS position attribute.
Parameters  
position
String. The value for the CSS position attribute.
Example
This example changes the type of CSS positioning in use:
function changePosition( ){
  var pos = viewer.getPosition( );
  if (pos == 'relative')  {
    viewer.setPosition('absolute');
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.setParameterValues
Syntax
void XTabAnalyzer.setParameterValues(actuate.xtabanalyzer.ParameterValue[ ] parameterValues)
Sets the CSS position attribute.
Parameters  
parameterValues
actuate.xtabanalyzer.ParameterValue[ ] or actuate.parameter.ParameterValue[ ]. An array of parameter values.
actuate.XTabAnalyzer.setReportletDocumentMode
Syntax
void XTabAnalyzer.setReportletDocumentMode(boolean reportletMode)
Sets whether the viewer displays documents as reportlets.
Parameters
reportletMode
Boolean. True indicates reportlet display mode.
actuate.XTabAnalyzer.setReportName
Syntax
void XTabAnalyzer.setReportName(string reportName)
Sets the report file name for the viewer. The file must be a report document file or report design file.
Parameters
reportName
String. The name of the report file.
Example
This example sets the report name to reportfile.rptdocument and reloads the Data Analyzer viewer with its content:
function run( ){
  container = document.getElementById("acviewer");
  viewer = new actuate.XTabAnalyzer(container);  
  viewer.setReportName("reportfile.rptdocument");
  viewer.submit( );
}actuate.XTabAnalyzer.setService
Syntax
void XTabAnalyzer.setService(string iPortalURL, actuate.RequestOptions requestOptions)
Sets the Actuate web application URL. This function can request options for that URL.
Parameters
iPortalURL
String. The URL of the Actuate web application.
requestOptions
actuate.RequestOptions object. Request options for the web application. This parameter is optional.
Example
This example sets the service and request options:
function setServerOptions(URL,options){
  viewer.setService(URL,options);
}
actuate.XTabAnalyzer.setSupportSVG
Syntax
void XTabAnalyzer.setSupportSVG(boolean svgFlag)
Sets a flag indicating whether or not the browser supports SVG.
Parameters
svgFlag
Boolean. Flag indicating SVG support in the browser. This parameter’s value is true when the browser supports SVG and false in all other cases.
Example
This example sets the browser’s level of SVG support:
function setSVG(flag){
  viewer.setSupportSVG(flag);
}
actuate.XTabAnalyzer.setTop
Syntax
void XTabAnalyzer.setTop(integer top)
Sets the top margin for the viewer.
Parameters
top
Integer. The top margin for the viewer in pixels.
Example
This example retrieves the current top margin for the viewer and moves the margin 20 pixels down the screen when the current position of the margin is fewer than 45 pixels from the top of the screen:
function moveTopMargin( ){
  var top = viewer.getTop( );
  if (top < 45){
    top = top + 20;
    viewer.setTop(top);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.setUIOptions
Syntax
void XTabAnalyzer.setUIOptions(actuate.xtabanalyzer.uioptions options)
Sets the user interface options enabled for the viewer.
Parameters
options
Actuate.xtabanalyzer.uioptions object. The options object for the viewer.
Example
This example retrieves the user interface options and sets one of the UIOptions values:
function resetUIOptions( ){
  var options = viewer.getUIOptions( );
  options.enableToolbar(false);
  viewer.setUIOptions(options);
}
actuate.XTabAnalyzer.setWidth
Syntax
void XTabAnalyzer.setWidth(integer width)
Sets the width for the viewer.
Parameters
width
Integer. The width for the viewer in pixels.
Example
This example retrieves the width of the viewer. When the viewer is fewer than 630 pixels wide, the example code doubles the viewer’s width:
function doubleWidth( ){
  var width = viewer.getWidth( );
  if (width < 630){
    viewer.setWidth(width * 2);
    viewer.submit( );
  }
}
actuate.XTabAnalyzer.setXTabBookmark
Syntax
void XTabAnalyzer.setXTabBookmark(string bookmark)
Sets the bookmark for a cross tab to render in the viewer.
Parameters
bookmark
String. The bookmark for a cross tab.
Example
This example retrieves the bookmark for the cross tab the viewer is associated with, changes the bookmark, and reloads the bookmark. This functionality enables the use of multiple cross tab elements within a single design.
function changeBookmark( ){
  var oldBookMark = viewer.getXTabBookmark( );
  viewer.setXTabBookmark("crosstab2");
  viewer.submit( );
}
actuate.XTabAnalyzer.setXTabIid
Syntax
void XTabAnalyzer.setXTabIid(string iid)
Sets the instance ID for viewer rendering. This function is useful in integration with Interactive Viewer, and supports the ability of Interactive Viewer to obtain and use the cross tab instance ID.
Parameters
iid
String. The instance ID.
Example
This example sets the cross tab instance ID:
function setxtabInstance(id){
  viewer.setXTablid(id);
}
actuate.XTabAnalyzer.submit
Syntax
void XTabAnalyzer.submit(function callback, boolean rerun)
Submits requests to the server for the Data Analyzer viewer. This method triggers an AJAX request to submit all pending operations for this object. The server returns a response after processing the pending operations. The results render on the page in the Data Analyzer container. The submit( ) function throws an exception when another submit( ) operation is pending. A CONTENT_CHANGED event fires when the Data Analyzer content changes.
Parameters
callback
Function. Optional. A function called when submit completes. This function receives the current XTabAnalyzer object as an input parameter.
rerun
Boolean. Optional. Indicates whether re-run the report design when it refreshes. Default to true.
Example
This example retrieves the left margin of the viewer and expands the margin. The change does not take effect until submit( ) executes. The submit( ) function calls the function in the submitCallback parameter when submit( ) finishes executing. The callback function contains any processing that must occur after submit( ) finishes. Do not place code after the submit( ) call in the same function because submit( ) is asynchronous.
function moveLeftMargin( ){
  var left = viewer.getLeft( );
  if (left < 45)  {
    viewer.setLeft(left + 20);
    viewer.submit(submitCallback);
  }
}

Additional Links:

Copyright Actuate Corporation 2012