InetSoft Product Instructions: Reusable Report Logic - Report Beans

A report bean is a reusable set of report components that can be managed as a single unit. It is a very effective tool for building component-based reports, improving reusability and reducing report development time.

You can configure report beans (without scripting) to expose certain sets of properties to the report developer, and this approach is sufficient for most reports. However, you can also implement reusable report logic by embedding scripts within beans. The following sections discuss issues related to placing script inside report beans.

Bean Handlers

A report bean is treated as a mini-report. The bean has its own onLoad Handler and onInit Handler, just like a regular report. However, a bean does not have an onPageBreak Handler or onPrint Handler. All page break events are handled by the parent report.

The bean's onInit handler is invoked when the report loads, before the report parameters are prompted. Like the report onInit handler, the bean's onInit handler is invoked exactly once per instance. If a report bean is used in multiple instances in one report, the onInit handler for each instance is executed once.

Script that you attach to a bean runs within bean scope. This means that you can have multiple instances of a bean within the same report, and any script reference to an element within the bean is resolved to the instances inside the self-same bean.

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

Bean Scripting Scopes

A bean has its own scripting scope, similar to a report's scope, and all elements within the bean fall within the bean's scope. Therefore, if you place a script on an element within a bean, when the script encounters a symbol (variable, property), the server checks for the reference in the following sequence:

1. Search element scope (i.e., properties defined by the element to which the script is attached).

2. Search the bean “report” scope (i.e., properties defined by the onInit Handler and onLoad Handler of the bean containing the element).

3. Search the bean “element” scope (i.e., properties defined by element-level script attached to the bean element within the parent report).

4. Search parent report scope.

5. Search global scope.

Accessing Report Elements of Same Name

Because the server searches bean scope first, variables and elements in the bean will hide objects of the same name in the containing report. To access such objects in the containing report, use the ParentReport Object. For example, if the bean contains a text element with Element ID of 'Title', and the parent report also contains a text element with Element ID of 'Title', you can access the parent report instance as follows:

 parentReport.Title
    or
 parentReport['Title'] 

Dynamically Modifying the Parent Report

Scripts in a bean can dynamically access elements and variables in the parent report scope. For example, you could develop a “toolbar bean” that contains different chart type “buttons”. When the user clicks a button, this changes a chart in the parent report to the selected type. To do this, you could add an onClick Handler script to each button, such as the following:

// script for line chart button 
Graph1.singleStyle['Count(Total)'] = Chart.CHART_LINE 

This bean can then be embedded in any report that has a chart called 'Chart1'. The bean itself contains no chart called 'Chart1'; the server locates the parent report's 'Chart1' at runtime by looking up the name in the scope hierarchy.

Accessing Bean Properties from ParentReport

From within the parent report scope, you can modify the properties of elements located in a bean by using the 'elements' property of the bean.

For example, consider a report that contains a bean called “Bean1,” which in turn contains a text element called “Text1” and a table element called “Table1.” To access the properties of these bean elements from with parent report script, using the following syntax.

Bean1.elements.Text1.text= 'hello'; 
Bean1.elements.Table1.table[0][0] = 'Order ID';
Read why choosing InetSoft's cloud-flexible BI provides advantages over other BI options.

More Articles About Reporting

Assortment of Good Management Dashboard Examples - Below are some good examples of management dashboards. A management dashboard can be looked at as an executive tool whose sole purpose it to make information easier to read. These dashboards can include a variety of different types of data, which can all be integrated into an easy to read dashboard. Good management dashboards allow users to seamlessly transition from one graph to another, without losing any important data. In order to gain the competitive edge in a particular market, your business needs to be able to read, track, and convert the data that is constantly changing everyday. These interactive dashboards control every aspect of your business. Whether you need to keep track of daily expenses, monthly inventory reports, or quarterly earning, a good management dashboard can help do that...

Content Effectiveness Dashboard - A Content Effectiveness Dashboard focuses on measuring the performance and impact of content marketing efforts. The KPIs and metrics tracked on such a dashboard typically include: Website Traffic: Monitoring metrics such as total website visits, unique visitors, and pageviews helps assess the overall reach and visibility of the content. Engagement Metrics: Tracking metrics like time on page, bounce rate, pages per session, and scroll depth provides insights into how users interact with the content and its effectiveness in capturing and retaining their attention. Conversion Rates: Measuring conversion metrics such as lead generation, form submissions, email sign-ups, and downloads indicates how well the content is driving desired actions and contributing to the sales funnel...

Drilling Down into Emergency Reports - With InetSoft's easy-to-use drag and drop design tools, emergency service providers can quickly build productive analytical tools that aid users in day-to-day operations, as well as help them keep track of and achieve long term goals and objectives. InetSoft has a library of charts and visualization types to choose from, including geographic mapping, heat maps, and scatter plots. Healthcare industry executives can cater any completed dashboard to specific needs at any given time and even access them from mobile devices such as smartphones and tablets...

Healthcare Patient Satisfaction Dashboard - This hospital hashboard is an example of one of InetSoft's interactive web-based applications for healthcare companies. This particular chart allows users to monitor Patient detail ranging from the Patient ID, Gender and Age, as well as being able to filter the age to better narrow down a desired Patient Detail. This dashboard displays Staff to Patient ratios including department names and the number of doctors in those departments. Although our charts are simple to use they provide detailed fields and extensive results which will give you the most out of your data. healthcare management dashboard example More Dashboard Examples InetSoft's easy-to-use drag and drop design tools, healthcare companies can quickly build productive analytical tools like this one, that aid users in day-to-day operations, as well as help them keep track of and achieve long term goals and objectives...

Online Streaming Dashboard Example - This dashboard, created with Style Intelligence offered by InetSoft can provide video streaming companies with integrating data from multiple channels, helping to present trends, highlight comparisons and focus on problems, so that managers can find an entry point to observe complex data situations. When a large amount of real-time data is pouring into the database of stream video companies every day, the data modelling engine from Inetsoft enables companies to quickly massage their data so that it is ready to create data visualizations. Inetsoft's focus in their products is ease of implementation. This InetSoft dashboard can easily adapt to any and all devices, not just PCs, with managers checking the dashboard at any time from their mobile phones or tablets...

Quality Control Analysis with InetSoft - InetSoft's Style Intelligence provides clients with a user-friendly interface that integrates a library of useful tools for creating, managing, or analyzing data sources. With InetSoft's powerful business intelligence solution, you can: Mash up data from almost any data source Quickly profile data and verify data manipulations via data visualization Create pie charts, scatter plots, interactive maps, and more with just a few clicks Cater any dashboard solution to your specific needs with easy-to-use drag-and-drop design tools Visually analyze machine learning results to find hidden patterns with InetSoft's built-in machine learning capability...

Telecommunications Analytics and Dashboards - The telecommunications dashboard here is an example of one of InetSoft's interactive web-based BI application being used by a telecom company. This particular chart allows users to monitor and research mobile subscriptions information by geography. With a point and click environment, users can drilldown into details by specific query such as state or population for an accurate analysis on one unified screen...

Visual-Driven BI in Neuroscience - The NeuroBrain Research Institute (NBRI) is a premier organization dedicated to advancing the understanding of the human brain through cutting-edge neuroscience research. Established in 1990, NBRI collaborates with academic institutions, hospitals, and pharmaceutical companies to explore brain functions, neurological disorders, and potential treatments. The institute's mission is to translate complex brain research into meaningful clinical applications that improve patient outcomes. Challenge: NBRI faced significant challenges in managing and analyzing the vast amounts of data generated from its research activities. Data sources included brain imaging, electrophysiology, genetic sequencing, and clinical trial results. The complexity and volume of data made it difficult for researchers to extract meaningful insights efficiently. Traditional data analysis methods were time-consuming...

Previous: Report Sections