InetSoft's Reporting Software:

Report Script - Common Element Properties

Visibility Property

You can dynamically hide or show an element using script. Typically, you would test a condition or user input at runtime, and then hide one or more elements to present an appropriate view.

if(field['discount'] == 0) {
  Text8.visible = false;
}

As for all element properties, you should change the visibility of an element only from within a script attached to the same element, or from within the onLoad Handler. Otherwise, the location of the element in the report may influence the outcome.

Alignment Property

The Alignment property controls both the horizontal and vertical alignment of report elements in the page layout. The horizontal alignment is specified by the alignment constants H_LEFT, H_CENTER, and H_RIGHT. (See Alignments.)

alignment = StyleReport.H_CENTER; 

The vertical alignment property can be combined with the horizontal alignment property by using the bitwise OR.

 alignment = StyleReport.H_CENTER | StyleReport.V_CENTER; 

The four vertical alignment options are V_TOP, V_CENTER, V_BOTTOM, and V_BASELINE.

view demo icon
View a 2-minute demonstration of InetSoft's easy, agile, and robust BI software.

fullName Property

Each element has a unique name, contained in the fullName property. For regular elements, this is the same as the element ID. For elements within a bean, this is given by the bean ID appended with the element ID. For example, an element with ID “TitleText” that is contained within a bean with ID “HeaderBean” has a fullName property of “HeaderBean.TitleText”.

Target Property

The target name for an element can be used to make the element the destination of a hyperlink (similar to an HTML anchor).

 target = 'SalesTitle' // e.g., static target text 
target = text         // e.g., dynamic target text 

As shown above, you can set the target property dynamically, for example, to the text property of a Text element. See Hyperlinks to Targets (Anchors), in Report Designer, for information about targeting hyperlinks to report elements.

Common Constants

Many properties use predefined constant values. Some of these constants are defined in individual classes, such as the StyleFont styles. But most of the constants are defined in the global StyleReport Object. This includes all line styles, chart types, table layout options, wrapping styles, page orientation, alignments, point shapes, and textbox shapes.

Adding Tooltips to a Dashboard or a Report

To add a tooltip to a report or dashboard element, use the function addStatus(eid, item, message). The 'message' string is shown as a tooltip when the user moves the mouse over the report element with ID specified by 'eid'. If the user's browser permits status bar scripting, the 'message' string is also displayed in the status bar. (Status bar scripting is disabled by default in modern browsers.)

As an example, consider the following script, which you could place either in element-level or report-level script:

replet.addStatus("Title",null,"Example report"); 

The element with the ID “Title” will now display the tooltip text “Example report” when viewed in the Report Portal.



Previous: Report Element Script