The previous two types of parameters are both for creating a report. After a report object is created, there are many ways that it can be modified by the users. One of these is the predefined 'Customize' parameter. We will discuss more interactions in the Event Handling chapter. The 'Customize' parameter is a special parameter that is recognized and processed by the replet environment.
If a replet declares a 'Customize' parameter, a 'Customize' button is placed on the viewer window. When the button is clicked, the viewer pops up a request dialog with the specified customization parameters. After the user clicks 'OK' on the dialog, a RequestEvent is sent to the replet. By default, when a RequestEvent is received at a replet, the createReport() is called with the request object and the report is refreshed with the new report object returned from the method. A program can also override the default handling and process the RequestEvent directly. We will cover the event handling process in more detail in the 'Event Handling' section.
A replet can have code in the createReport() method to modify the existing report using the parameters in the customization request. It can even create a completely new report object if it chooses to. This customization method is very simple from both the programmers and end users' point of view and is the preferred method for report customization.
Example: Customization Parameter
We change the previous example by adding a 'Customize' parameter to the replet. The parameter controls the visibility of the report title.
Customizable Report
package inetsoft.demo.replets;
import inetsoft.sree.*;
import inetsoft.report.*;
import inetsoft.report.chart10.*;
import inetsoft.report.io.*;
import inetsoft.report.lens.*;
import java.util.*;
import java.io.*;
public class Replet4 extends BasicReplet {
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);
} catch(Exception e) {
e.printStackTrace();
throw new RepletException(e.getMessage());
}
}
public ReportSheet createReport(RepletRequest req) {
// set the data on the template
report.setElement("Table1", ttl);
//set the text value to the title
report.setElement("Text1", req.getString("Title"));
report.getElement("Text1").setVisible(req.getBoolean("Show Title"));
return report;
}
ReportSheet report;
TextTableLens ttl;
}
Notice how we add all parameters (customization and creation) to each RepletParameter object. This is so that none of the creation parameter values get lost when we refresh the report with the customization parameters.We add this replet to the repository, then use the web viewer to view it
Notice that the 'Customize' button is activated on the report toolbar on the requested report. A small 'Customize' button is also placed on the status bar of the viewer window as an extra visual indication. Clicking on either of the buttons brings up the customization dialog. In this example, a 'Show Title' checkbox will appear in the customization dialog.
Unselect the checkbox and submit the customization request (set the title to be invisible). The report is refreshed to show the new presentation option without the report title.
More Articles About Reporting
BI Tool for Informatica - Looking for a good BI tool for Informatica? InetSoft's pioneering dashboard reporting application makes producing great-looking web-based reports and dashboards easy with a drag-and-drop designer and the ability to connect to all your data sources. Maximize self-service for all types of users. View a demo and try interactive examples...
Cattle Ranching KPIs - In beef cattle ranching, tracking specific Key Performance Indicators (KPIs) and metrics is essential for optimizing operations, improving productivity, and ensuring profitability. Here are some key KPIs and their definitions, along with their significance in performance management: 1. Calving Rate Definition: The percentage of cows that give birth to healthy calves in a given period. Significance: High calving rates indicate good herd fertility and effective breeding practices, crucial for maintaining or increasing herd size and productivity. 2. Calf Mortality Rate Definition: The percentage of calves that die before weaning. Significance: Low mortality rates reflect good herd health management and care practices, directly impacting the number of calves that reach maturity...
Energy Intensity KPI - A key performance indicator (KPI) called energy intensity calculates the amount of energy consumed per unit of output. This may be represented as energy per building square foot or as energy per manufacturing unit. Energy management dashboards let businesses understand how effectively they utilize energy in their operations by calculating and displaying energy intensity. For benchmarking purposes and to find ways to increase energy efficiency, this KPI is essential...
Evaluate InetSoft's Web Based KPI Dashboard Application - Are you looking for a good web based KPI dashboard application? InetSoft's pioneering dashboard reporting solution produces great-looking interactive dashboards with an easy-to-use drag-and-drop designer. Maximize self-service for all types of users. No dedicated BI developer required. View a demo and try interactive examples...
How Is InetSoft's Data Presentation Software So Easy to Use? - Data presentation is the means by which more and more organizations are answering key questions about their businesses. Data presentation consists not so much of presenting raw data, but of information, such as complex numbers and statistics, in a clear and beautiful way through mediums such as bar and line graphs, or pie charts. Data presentations have advanced in the post-digital age to become much more dynamic, interactive, and present even more crucial information. In fact, data presentations deliver important stories and messages about one's business operations, trends, performance, and more, in novel ways...