InetSoft Technology: Example of an Executable Report



We start our example by creating a static replet. To make running the examples easy, we do not use a database, but get data from a delimited data file.


BI DemoRegister

  1. We will use the template 'embeddedtable.srt' we created in the Report Creation With Grouping/Summarization section from the Sorting and Groupingchapter. This template contains a table with just the header row (meta-data) specified as embedded data, along with grouping, summarization and Top N filtering, but contains no actual data binding. The data is supplied during report construction in the replet.
  2. package inetsoft.demo.replets;
     
    import inetsoft.sree.*;
    import inetsoft.report.*;
    import inetsoft.report.io.*;
    import inetsoft.report.lens.*;
    import java.io.*;
     
     
    public class Replet1 extends BasicReplet {
    public void init(RepletRequest req) throws RepletException {
    try {
    // load the report template
    InputStream input = getClass().
    getResourceAsStream("embeddedtable.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);
    } 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);
    return report;
    }
    ReportSheet report;
    TextTableLens ttl;
    }
    
  3. After the replet is compiled, use the Enterprise Manager to register the replet. (See Registering Reports in the Administration Reference.)
    1. Start the Enterprise Manager and select the Report tab.
    2. Click the 'Repository' tree node, select the 'New Report' link at the bottom of the screen.
    3. Enter 'Replet1' in the 'Name' field, select 'Class' for 'Type', and enter 'inetsoft.demo.replets.Replet1' in the 'Path' field.
    4. Click 'Apply' to register the replet.
  4. Test the registered replet by viewing it in the User Portal.

Using the Web Viewer to View the Report Replet

To use the Web Viewer to view the replet, we need to deploy the servlet version of the repository in the application server of your choice. The deployment of a servlet may differ between different servlet engines.

The Application Server needs to have a webapp with the appropriate InetSoft JARs, and a registered servlet.

The init argument specifies the location of the configuration files. Usually the 'classes' directory of the webapp. The ServletRepository needs to be identified as follows:

MAPPING Examples (the name used in the url)

Class Name inetsoft.sree.web.ServletRepository

Init Arguments sree.home=c:/Tomcat/webapps/sree/WEB-INF/classes





The servlet and reports can be deployed directly from the Enterprise Manager in supported servers, or deployed manually following application server instructions.


After the servlet is properly setup, we can start a browser and point it to our servlet, for example URL: http://localhost:8080/sree/Reports.

When the URL is accessed, it shows a hierarchical view of the repository contents. Select a replet on the tree. The viewer window for that report comes up on the main window frame.


The viewer window shows one page at a time. It has navigation buttons to move to other pages of a report. We cover the details of the Web Viewer in the End User.