Example of a Report Event Handler

To illustrate the use of the event handler, we add two embedded request links. When a link is clicked on, it sends a CUSTOMIZE request to the replet, which sets the visibility of the report title.
#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

public void init(RepletRequest req) throws
RepletException {
try {
// load the report template
InputStream input = getClass().
getResourceAsStream("/" + req.getParameter("templateName") + ".srt");
 
Builder builder = Builder.getBuilder(Builder.TEMPLATE, input);
report = (ReportSheet) builder.read(".");
// load data from data file
InputStream input2 =
getClass().getResourceAsStream("/data/education.csv");
 
ttl = new TextTableLens(input2,",");
ttl.setHeaderRowCount(1);
 
RepletParameters def =
new RepletParameters(RepletRequest.CUSTOMIZE);


def.addBoolean("Show Title", true);
 
def.addParameter("Title", "", null);
def.setVisible("Title", false);
 
RepletParameters def1 = new
RepletParameters(RepletRequest.CREATE);
def1.addParameter("Title", "", null);
 
def1.addBoolean("Show Title", true);
def1.setVisible("Show Title", false);
 
addRepletParameters(def);
addRepletParameters(def1);
 
EventHandler eh = getEventHandler();
RepletRequest q1 =
new RepletRequest(RepletRequest.CUSTOMIZE);
q1.setParameter("Show Title", new Boolean(true));
 
// the following call is equivalent to addRequest()
// except addRequest() also inserts commands to change
// the cursor to HAND when the mouse moves on the link
 
eh.addMouseClickCommand("ShowTitleLink", null,
RepletCommand.sendRequest(q1));
 
RepletRequest q2 =
new RepletRequest(RepletRequest.CUSTOMIZE);
q2.setParameter("Show Title", new Boolean(false));
eh.addMouseClickCommand("HideTitleLink", null,
RepletCommand.sendRequest(q2));
 
} catch(Exception e) {
e.printStackTrace();
throw new RepletException(e.getMessage());
}
}

We can then run the replet and click on the two links ('Show Title' and 'Hide Title') to make the report title visible/invisible.

More Articles About Reporting

Change Management Metrics - Implementing updates, patches, and system changes without interfering with existing operations requires effective change management. IT operations analysts may assess the efficacy of change management using the KPIs and data below: Change Success Rate: The proportion of changes that are executed without leading to issues or service interruptions is measured by the change success rate. Effective change management procedures are those that have a high success rate. Change Lead Time: The period between the start and completion of a change request is known as the "change lead time." Analysts may evaluate the effectiveness of change management procedures and pinpoint areas for improvement by tracking the change lead time...

Commerce Transportation Metrics - In international commerce, efficient transportation is essential. GTM dashboards provide transportation-related KPIs and information. Transportation Cost per Unit: This KPI determines how much it costs to ship each product unit. By examining this measure, transportation routes and carriers may be optimized to save money. Carrier Performance Analysis: Analytics solutions are able to monitor carrier performance in relation to service level agreements, damage rates, and on-time delivery. Using this information can help you choose reputable carriers...

Incident Severity Distribution - Finding the percentage of critical, high-priority, and low-impact occurrences is made easier by analyzing the distribution of incidents based on severity categories. With a reduced MTTR requirement, high-impact issues may be addressed with the help of this KPI...

Select the KPIs for an Order Fulfillment Dashboard - Selecting the KPIs for an order fulfillment dashboard requires input from various stakeholders involved in the order processing and fulfillment process. The best person or team for this task typically includes individuals with expertise in supply chain management, logistics, operations, and customer service. Among these, the supply chain manager or director often plays a central role due to their comprehensive understanding of the end-to-end order fulfillment process, from order receipt to delivery. Their insights into inventory management, warehouse operations, transportation logistics, and supplier relationships...

Student-Teacher Ratio - Definition: The number of students divided by the number of teachers. Significance: Lower ratios are often associated with more personalized attention and better student outcomes...

Transformation of Finance in BI - I believe we're really seeing a transformation of Finance. They are moving towards being that strategic advisor for the business. But one of the big challenges for CFOs and for finance departments is they're really trying to balance that with being a cost center. There's always a push for greater efficiency and cost containment. So at one level, they're trying to drive cost out of the business and do things as efficiently as possible. At the same time Finance is being asked, and the organization wants them to become much more of a strategist and strategic advisor to the business...

Previous: Accessing the Report Event Handler