Creating Data Driven Web Apps with BIRT - Michael Williams

563 views

Published on

Why spend the time structuring and processing your data, only to turn around and present it in some boring format, like a list or table? Using BIRT to make your application’s data visualizations pop, is easier than you might think. This talk will focus on several different ways that you can integrate BIRT into your application, including running reports with the APIs, customizing the viewer, integrating the viewer into JSP and JSF, and more.

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
563
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Reporting has changed
  • Plus RedShift
  • Creating Data Driven Web Apps with BIRT - Michael Williams

    1. 1. 1Actuate Corporation © 2012Creating Data Driven Web Apps with BIRTMichael Williams6-4-2013
    2. 2. 2Actuate Corporation © 2012Today’s Agenda and Goals• Introduction to BIRT• Designing BIRT Reports• Designer• APIs• Deploying BIRT• BIRT Viewer• Report Engine (Java)• JavaScript API• Questions
    3. 3. 3Actuate Corporation © 2012Introduction to BIRT
    4. 4. 4Actuate Corporation © 2012Actuate Launches the BIRT ProjectAUGUST2004Actuate JoinsEclipse Foundationas Strategic Developerand Board MemberActuate proposed and startedBIRTBusiness Intelligenceand Reporting Tools Project… a top-level Eclipse projectAdds BI and Reportingas Open Source ProjectProfessional open sourcePrimary development resourcesfunded by ActuateContributions from many sourcesIBM, Innovent Solutions and community
    5. 5. 5Actuate Corporation © 2012Simplicitythat makessimplelayouts easyPowerto createvery complexlayoutsBIRTBusiness Intelligence and Reporting Tools• Makes all data-driven content development easy• Modern, web-page design metaphor• Open and standards-based• Flexible with rich programmatic control• Full support for libraries and reuse• Foundation for a range of solutionsA New Generation of Data Visualization Technology
    6. 6. 6Actuate Corporation © 2012BIRT Release HistorySeptember 2004 BIRT Project proposal accepted, and project launchedJune 2005 1.0 Eclipse Report Designer, Report Engine, Chart EngineDecember 2005 2.0 Support for a wide variety of common layoutsJune 2006 2.1 Advanced parameters, ability to join data sets, …June 2007 2.2 Dynamic crosstab support, web services data source, …June 2008 2.3 JavaScript Debugger, BiDi Support, Charts in Crosstabs, …June 2009 2.5 Page aggregates, Multiple drill-downs in Charts, …June 2010 2.6 New charts, more chart control, developer productivity, …June 2011 3.7 POJO Runtime, Hive/Hadoop, Open Office emitters…June 2012 4.2 Maven Support, Excel Data Source, Relative Time Periods…June 2013 4.3 MongoDB & POJO ODAs, PPT & Word 2010 Support, XLSX Support…• Ground-up initiative: Innovative approach to layout and design• Developed in the open with community feedback at all stages
    7. 7. 7Actuate Corporation © 2012BIRT Example Key CapabilitiesVery Simple to Very Complex Layouts• Listings, cross-tab, dashboard, pixel-perfect, charts …• Grouping, advanced aggregations, sub-totals, calculations• Multi-section and sub-reports• Conditional sections and logic• Full programmatic control/scripting• Embedded images…Comprehensive Data Access• SQL databases, Web Services, Flat Files,XML, scripted data sources …• Multiple data sources in one design…Output Formats• HTML, PDF, Excel, Word, PowerPoint…• Internationalization of labels and text• Bi-Directional language displayRe-use and Developer Productivity• Library support for publishing andsharing components• Leverages common standards (SQL,HTML, JavaScript, Java, XML)• Cascading Style Sheets• Built-in debugger…Interactivity and Linking• Data driven hyperlinks• Drill-through charts and graphics…Multiple Usage and Productivity Aids• Graphical layout and design• Query & metadata editors• Formatting Builder• Grouping Builder• Customizable cheat sheets andtemplates…
    8. 8. 8Actuate Corporation © 2012• BIRT Offers many ways to get data• Standard Data Sources• Flat File (CSV, TSV, SSV, PSV)• Hive Data Source• Cassandra Scripted Data Source• JDBC Textual or Graphical• Web Service - XPath syntax• XML - XPath syntax• XLS/XLSX• Scripted Data Source Written in Javaor JavaScript• Open Data Access (ODA) DTP Project• Extensible JDBC Driver Framework• More coming in BIRT 4.3BIRT Data AccessCommunity ContributionsGoogleDocsXML/ACasandraRESTMongoDBMulti-Flat FileGitHubTwitter JSON SearchDropbox usageYQLGoogle AnalyticsLinkedInFacebook FQL
    9. 9. 9Actuate Corporation © 2012BIRT DesignerHigh-Level BIRT ArchitectureBIRT EnginePresentationServicesDesign EngineGenerationServicesDataServicesChartingEngineEclipseDesignerChartDesignerEclipseDTP,WTP,…DataDataHTMLPDFExcelWordPowerPointPostScript…XMLDesignDocument
    10. 10. 10Actuate Corporation © 2012Design EngineReport EngineChart EngineProduces XML Report,Templates, and LibraryDesignsRuns Reports andproduces output – PDF,HTML, Doc, XLS, PS,PPT EtcConsume Chart EMFmodel and producesChart Output. Supports14 Main types and manysub types. Ouputs toPNG, JPG, BMP, SVG,PDF, SWT, and SWINGDE APIRE APICE APIAll Engines can be ran with or without OSGiReport Designer Chart Builder Example ViewerCan be ran outside of BIRTCore BIRT Open Source ProductsHigh Level BIRT Architecture
    11. 11. 11Actuate Corporation © 2012Designing BIRT Reports
    12. 12. 12Actuate Corporation © 2012The BIRT DesignerDEMO
    13. 13. 13Actuate Corporation © 2012BIRT Design GalleryCharts and TablesListing with Groups and Sub-Totals
    14. 14. 14Actuate Corporation © 2012BIRT Design GalleryCrosstabsCrosstab and Charts
    15. 15. 15Actuate Corporation © 2012BIRT Design GalleryFormsCalendar / Schedule
    16. 16. 16Actuate Corporation © 2012BIRT Design GalleryDashboardsMulti-Language and Bi-Directional
    17. 17. 17Actuate Corporation © 2012BIRT Chart Gallery
    18. 18. 18Actuate Corporation © 2012BIRT Chart Gallery
    19. 19. 19Actuate Corporation © 2012BIRT Chart Gallery
    20. 20. 20Actuate Corporation © 2012APIsDesign Engine API (DE API):Used to create custom reports, create custom report designer tools, or toexplore or modify BIRT report designs. It can also be called within BIRTscript to modify the report at runtime. The BIRT Designer is built using thisAPI.Chart Engine API (CE API):Can be used to create and render charts separately from BIRT. It can alsobe called in the chart script to modify a chart at runtime.Data Engine API:Used to define Data Sources and Data Sets, and to prepare anIQueryDefinition. It can also be used in script to process a Data Set’s data atruntime.
    21. 21. 21Actuate Corporation © 2012Deploying BIRT Reports
    22. 22. 22Actuate Corporation © 2012Multiple Deployment OptionsBIRT DesignBIRT Engine and APIsBIRT onDemandBIRT iHub
    23. 23. 23Actuate Corporation © 2012BIRT Web ViewerCopy WebViewerExample from theruntime download to the applicationserver and rename it “birt”
    24. 24. 24Actuate Corporation © 2012BIRT Web Viewer URLsWith viewer toolbar, pagination, etc.:http://localhost:8080/birt/frameset?__report=reportName.rptdesignAs a straight HTML output:http://localhost:8080/birt/run?__report=reportName.rptdesignOther servlet mappings:preview, document, output, extractURL parameters include:id title showtitle toolbar navigationbar localeformat report document parameterpage pagerange fittopagesvg isnull islocale masterpage resourceFolder bookmarkrtl page overwrite
    25. 25. 25Actuate Corporation © 2012BIRT Web Viewer URLsOutput to PDF:http://localhost:8080/birt/frameset?__report=reportName.rptdesign&__format=pdfTo display a single report item as a reportlet:http://localhost:8080/birt/run?__report=SD.rptdesign&__bookmark=myTable&__isreportlet=true
    26. 26. 26Actuate Corporation © 2012BIRT Viewer Tag LibraryExample JSP to embed viewer:<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib uri="/birt.tld" prefix="birt" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>My Report - JSP</title></head><body><birt:viewer id="birtViewer" reportDesign=“reportNamerptdesign"pattern="frameset"height="450"width="700"format="html"></birt:viewer></body></html>Live Example: http://localhost:8080/birt/dashboard.jsp
    27. 27. 27Actuate Corporation © 2012BIRT Viewer Tag LibraryExample JSP to embed parameters:<%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%><%@ taglib uri="/birt.tld" prefix="birt" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></head><style type="text/css">. class1 { background-color:#ff0000; color: #ffffff; }</style><body>Parameter Page 1<br><birt:parameterPageid="report1"name="page1"reportDesign="cascade_report.rptdesign"isCustom="true"pattern="frameset">…
    28. 28. 28Actuate Corporation © 2012BIRT Viewer Tag LibraryExample JSP to embed parameters (cont.):Cascading Parameter1: <birt:paramDef id="5" name="Country" /><br><br>Cascading Parameter2: <birt:paramDef id="6" name="City"/><br><br>Cascading Parameter3: <birt:paramDef id="7" name="Customer" cssClass="class1"/><br><br><input type="submit" name="submit" value="Sumbit form"/><br><br></birt:parameterPage><br></body></html>Live Example: http://localhost:8080/birt/cascade_report.jsp
    29. 29. 29Actuate Corporation © 2012Design EngineReport EngineChart EngineProduces XML Report,Templates, and LibraryDesignsRuns Reports andproduces output – PDF,HTML, Doc, XLS, PS,PPT EtcConsume Chart EMFmodel and producesChart Output. Supports14 Main types and manysub types. Ouputs toPNG, JPG, BMP, SVG,PDF, SWT, and SWINGDE APIRE APICE APIAll Engines can be ran with or without OSGiReport Designer Chart Builder Example ViewerCan be ran outside of BIRTCore BIRT Open Source ProductsHigh Level BIRT Architecture
    30. 30. 30Actuate Corporation © 2012Report Engine API (RE API)static void executeReport() throws EngineException{IReportEngine engine=null;EngineConfig config = null;try{config = new EngineConfig( );config.setLogConfig("C:BIRT_422logs", java.util.logging.Level.FINEST);Platform.startup( config );IReportEngineFactory factory = (IReportEngineFactory) Platform. createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );engine = factory.createReportEngine( config );IReportRunnable design = null;design = engine.openReportDesign("C:BIRT_422designsparam.rptdesign");IRunAndRenderTask task = engine.createRunAndRenderTask(design);task.setParameterValue("ordParam", (new Integer(10101)));task.validateParameters();…
    31. 31. 31Actuate Corporation © 2012Report Engine API (REAPI)PDFRenderOption options = new PDFRenderOption();options.setOutputFileName("my_report.pdf");options.setOutputFormat("pdf");task.setRenderOption(options);task.run();task.close();engine.destroy();}catch( Exception ex){ex.printStackTrace();}finally{Platform.shutdown( );}
    32. 32. 32Actuate Corporation © 2012RE API with JSFpublic class birt2jsf {String executeReport(String param) throws EngineException{IReportEngine engine=null;EngineConfig config = null;try{config = new EngineConfig( );config.setLogConfig("/logs", java.util.logging.Level.FINEST);Platform.startup( config );IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );engine = factory.createReportEngine( config );IReportRunnable design = null;design = engine.openReportDesign("E:/apache-tomcat-6.0.36/webapps/JSF_2/test.rptdesign");IRunAndRenderTask task = engine.createRunAndRenderTask(design);task.setParameterValue("Country", param);task.validateParameters();…
    33. 33. 33Actuate Corporation © 2012RE API with JSFIRunAndRenderTask task = engine.createRunAndRenderTask(design);task.setParameterValue("Country", param);task.validateParameters();HTMLRenderOption options = new HTMLRenderOption();ByteArrayOutputStream outs = new ByteArrayOutputStream();options.setOutputStream(outs);options.setImageHandler(new HTMLServerImageHandler());options.setBaseImageURL("images");options.setImageDirectory("E:/apache-tomcat-6.0.36/webapps/JSF_2/images");options.setEmbeddable(true);options.setOutputFormat("html");task.setRenderOption(options);String output;…
    34. 34. 34Actuate Corporation © 2012RE API with JSFtask.run();output = outs.toString();task.close();engine.destroy();return output;}catch( Exception ex){ex.printStackTrace();return "Error";}finally{Platform.shutdown( );RegistryProviderFactory.releaseDefault();}}}
    35. 35. 35Actuate Corporation © 2012RE API with JSF@ManagedBean(name="birtBean")@SessionScopedpublic class BirtBean implements Serializable {private static final long serialVersionUID = 1L;private String name;public String getReport() {birt2jsf report = new birt2jsf( );String reportHTML = null;try {reportHTML = report.executeReport(name);} catch (EngineException e) {e.printStackTrace();}return reportHTML;}public String getName() {return name;}public void setName(String name) {this.name = name;}}
    36. 36. 36Actuate Corporation © 2012RE API with JSF<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"xmlns:h="http://java.sun.com/jsf/html"><h:head><title>BIRT JSF 2.0 Example</title></h:head><h:body><h3>Enter Country</h3><h:form><h:inputTextvalue="#{birtBean.name}"></h:inputText><h:commandButton value="View Report" action="page-a"></h:commandButton><h:outputText value="#{birtBean.report}" escape="false"/></h:form></h:body></html>http://localhost:8080/JSF_2/
    37. 37. 37Actuate Corporation © 2012BIRT Viewer Toolkit (BVT) – Sneak PeekNew product being released by Actuate for use with open-source (OS)BIRT. BVT should be released soon for download on BIRT Exchange.Key Features:• It’s FREE!• It uses the Actuate Viewer (Built on OS Viewer)• More modern look and feel• More seamless parameter entry screen• Calendar date-picker• It’s built on the latest BIRT version (4.2.2)• Includes JavaScript API (JSAPI) AJAX library for easier integration intoapplications of all types.
    38. 38. 38Actuate Corporation © 2012Running Reports with BVTThe URL’s used with the OS viewer can still be used with BVT.With viewer toolbar, pagination, etc.:http://localhost:8080/BIRTViewerToolkit/frameset?__report=TableReport.rptdesignAs a straight HTML output:http://localhost:8080/BIRTViewerToolkit/run?__report=TableReport.rptdesignOutput to PDF:http://localhost:8080/BIRTViewerToolkit/frameset?__report=TableReport.rptdesign&__format=pdfTo display a single report item as a reportlet:http://localhost:8080/BIRTViewerToolkit/run?__report=SD.rptdesign&__bookmark=myTable
    39. 39. 39Actuate Corporation © 2012Running Reports with BVTParameterized report with date picker:http://localhost:8080/BIRTViewerToolkit/frameset?__report=DynamicParameter.rptdesignWhat that looks like with the OS viewer:http://localhost:8080/birt/frameset?__report=DynamicParameter.rptdesign
    40. 40. 40Actuate Corporation © 2012BVT and JSAPI<html><head><script type="text/javascript" language="JavaScript"src="http://localhost:8080/BIRTViewerToolkit/jsapi"></script></head><body onload="init();"><div id="myDivContainer" style="border-width: 1px; border-style: solid;"></div><script type="text/javascript" language="JavaScript">var myViewer;function init() {actuate.load("viewer");actuate.initialize( "http://localhost:8080/BIRTViewerToolkit/", null, "administrator", "", createViewer );}function createViewer() {myViewer = new actuate.Viewer( "myDivContainer" );myViewer.setReportName("/reports/TableReport.rptdesign" );myViewer.submit();}</script></body></html>Live Example: http://localhost:8080/BIRTViewerToolkit/JSAPIReport.html
    41. 41. 41Actuate Corporation © 2012Explore• Search/sort• Rate, comment• ForumsDownload• Documentation• Software• ExamplesContribute• BIRT designs, code• Technical tips• ContestsCentralized hub for BIRT developers• Access demos, tutorials, tips and techniques, documentation…• Enables developers to be more productive and build applications faster• Marketplace for applicationsBIRT Exchange Community Site
    42. 42. 42Actuate Corporation © 2012Creating Data Driven Web Apps with BIRTMichael Williamsmwilliams@actuate.comQuestions?
    43. 43. 43Actuate Corporation © 2012Actuate Products Built on BIRTBIRT Designer Pro:Enhanced emitters, HTML5 charts, flash charts, flash gadgets, flash maps,additional datasources, progressive viewing, etc.BIRT Interactive Viewer:Allows end users to add columns, apply formatting, move columns, addcharts, sort, etc.BIRT 360:Create visually pleasing, interactive dashboards quickly an easily using BIRTreport components, HTML5 & Flash gadgets, etc.BIRT Studio:Ad-hoc, web-based reporting tool for business users to create reports easily,without sending requests to IT.BIRT iHub:Deploy, manage, schedule, run, and distribute BIRT documents and webpages securely and easily.

    ×