1.11k likes | 1.56k Views
Basic BIRT Report Development. John Ward, Innovent Solutions. BIRT and us – Who are I? Who are you?. Who are we? John Ward, BIRT user Innovent Solutions Author: Practical Data Analysis and Reporting with BIRT Who are you? Name, Company, technical background (C, SQL, Java, reporting…)
E N D
Basic BIRT Report Development John Ward, Innovent Solutions
BIRT and us – Who are I? Who are you? • Who are we? • John Ward, BIRT user • Innovent Solutions • Author: Practical Data Analysis and Reporting with BIRT • Who are you? • Name, Company, technical background (C, SQL, Java, reporting…) • Experience with BIRT • What are you hoping to get out of today’s presentation? 2
Agenda • BIRT Overview • Lesson 1 – Simple Reports • Lesson 2 – Charting in Reports • Lesson 3 – BIRT Scripting • Lesson 4 – Report Libraries and Templates • Lesson 5 – Deploying with the Web Viewer
Objectives • Become Familiar with BIRT Designer • Know how to create and design BIRT reports and projects • Access Data in BIRT Reports • Report Layout and Formatting Using Styles • Sort, Group Data • Use Report Parameters • Create and Format Charts • Write Expressions Using Scripting • Creating and Using Libraries and Templates • Deploy BIRT Reports
BIRT Tasks – Audience BIRT Report Developers Advanced BIRT Developers Deploy Experts Reporting Integration BIRT Extension BIRT Core Development PresentationFocus Easy Hard • Drag & Drop, Charting, Properties • BIRT Scripting • BIRT Viewer • Design Engine API • BIRT Extension Points • Eclipse Development 5
BIRT Target Users & Benefits Managers • Focused on $, developer productivity • End user satisfaction • Minimizes Eclipse developer training • Increase developer productivity • Lower costs • Reports that support business activities • Ever changing business requirements End Users • Quick availability of reports • Reports that also look good • Content as HTML and PDF • Embed pre-designed reports in application • Designs reports using Eclipse-based designer • Creates report libraries & templates JavaDevelopers ReportDevelopers • Saves calories vs. JSP/Java • Minutes vs. days for HTML, vs. weeks for PDF • Minutes to modify as user requirements change • Iterative development gets the right reports quicker • Powerful and easy to use report designer • Creates & uses report libraries & templates • Flexible, web page design metaphor • Ability to leverage complex components
High Level BIRT Architecture Report Designer Report Engine EclipseReportDesigner Eclipse DTP ODA Chart Designer Custom Designer Data Transform. Services Charting Engine HTML PDF Print Presentation Services Generation Services Report Design Engine Data XMLReportDesign ReportDocument Data
Reporting Objectives: Become Familiar with BIRT Workbench To create a BIRT Reporting Project To create a BIRT Report Introduce the BIRT Workbench Create a simple Product Profitability & Inventory Report End User Customizing via Report Parameters
The Quick Tour • The BIRT Perspective • Data View, Palette, Outline View, Layout, Code, Preview • BIRT Data • Data Sources, Data Sets, Parameters • BIRT Layout • Grids, Tables, Controls, Data Binding • BIRT Code • Expression Builders vs. Code Pages • BIRT Preview • HTML View, BIRT Viewer, PDF Viewer 9
Birt Designer • Graphical report designer, similar to web development applications such as Dreamweaver or Nvu • Provides visual environment to quickly “draw” reports • Provides mechanisms to quickly create data connections • Provides Project Management
Navigator • Navigates through Eclipse projects and files under those projects • Allows user to run report inside of BIRT
Outline • Provides hierarchy of current report • Allows for easy navigation of report elements to change properties in the property pane • When selecting libraries, use the outline to copy non-visual components such as data sources and sets
Palette • Contains a number of visual elements used in BIRT report designs • Similar to Toolboxes in MS Visual Studio and other visual IDE
Data Explorer • Contains. • Data Sources: Connections to database. • Data Sets: Same as a Recordset. Allows users to navigate through Query Results. • Report Parameters: Used as the interface for report parameters that will be passed to a Data Set.
Report Designer • Area where report layout is designed, previews of the report are seen, scripts and events are coded, and XML source for report can be viewed.
Areas of the BIRT Workspace (Cont.) • Properties Pane. • Properties for BIRT objects can be modified, such as Data Set Binding, Font information, formatting for Data Set returns such as Row Highlighting and Color Alternation.
Top Level Report Layout • Master Pages • Contains elements visible on every page, such as page headers • Grids • Used to position elements on page • Contains no Data Bindings • Tables • Grids with Data Binding • Has Header, Detail, and Footer bands • Lists • Single Column Tables
Demo – Static Report Background: Our Manager, Mr Ernie, wants a generic letterhead. Build a letter head for Classic Cars using containers to format the layout. Objectives: Familiarize you with the concept of containers for Report Elements
Setting up a Project • BIRT uses the eclipse paradigm of using projects • File/new/project • From the project wizard, select report project from under BIRT • Set project name • Projects are shown in the eclipse navigator
Setting up a Report • With eclipse project open • From file menu • File/new/report • From navigator • Right-mouse click on report project, new/report • Select project to associate report with and give file name
Data Access • Data Sources • Handled data connections • Data Sets • Defined Data to be used in Report • Parameters • Used for User Interaction to Filter Data • Cascading Parameters • Parameter Binding
Setting up JDBC • Setup is done via the Data Explorer when setting up a new data source. • Click on the “manage drivers” button. • Point to JDBC ZIP/JAR file. • In order to set up connection, you must know the JDBC URL. • Can set a template of the JDBC URL format for future use of driver. This makes it easier for future connections. • Datasources can be added to libraries for report projects that use consistent datasources.
Creating a Data Set • With data source(s) created, right-click on data set and chose new. • Type in SQL query. • Can create Joined Data Sets to combine 2 or more data sources. • Here I am using a questionmark, which will bind a report parameter to a query. • Datasets can be added to libraries. • http://birtworld.blogspot.com/2006/05/joined-data-sets-with-birt-21.html
Report Parameters • Used to create dynamic result sets from queries • Binds user input to filter results sets • Parameters get assigned in sequential order, first parameter gets assigned to first bind variable in query • Report Parameters get stored as global variables in reports, accessible in scripts and expressions in addition to data.
Tables • Slots • Header • Detail • Footer • Data Binding • Makes table/list aware of values in Data Set • Grouping • Group on value in Data Set • Sorting • Sort on value in Data Set
Styles • Built In • CSS • Themes
Aggregates • Aggregate operations • Sum • Avg • Count • Done at the binding level
Viewing Reports • Preview • Web Viewer • Emitters
Report Run • Can Run from Navigator or from File Menu • Reports that get run open in separate browser window. • Results can be saved. • Option to view as HTML, Word, Excel, PDF
Demo – Building Reports - Product Profitability Report Scenario: You work for the Classic Cars company. Your boss, Mr Ernie, wants a report that is a simple listing of all product sales in the database, with the total costs and total profits for each product arranged by State and City, sorted in order of decreasing amounts of total profits. Provide a report parameter to limit the listing to just 1 state. Make sure that the parameter only lists those states already in the database. Objective: To Familiarize ourselves with building reports with Data awareness and work with data.
Demo – Product Profitability Report • Bring up Eclipse • Open the BIRT Perspective • In the Navigator View create a BIRT Report Project • In the Project create a BIRT Report • Add a data source to the Classic Models Sample database • Add a data set to list products, total costs, total profits • Add report items • Format report • Group items • Sort items • Add report parameters • Add data set parameters • Preview
Basic Concepts – Charting in Reports • Charts integrated with BIRT Report Designer • Charts can be used standalone as a library • Wide variety of chart types • Many formatting options • Charts are extensible to include more types
Pie Charts 2D, 2D with depth Ratio, Explode slices, Min Slice 36
Horizontal, Vertical 2D, 2D w/depth, 3D Stacked, Side-by-side Percent, Logarithmic Bar Charts 37
Bar Charts 38
Line Charts Horizontal, Vertical 2D, 3D Various types of markers Line styles, thicknesses Drawn as Line, Curve 40
Stock Charts CandleStick / Bar Stick Horizontal, Vertical 2D Formatting control 41
Scatter Charts Horizontal, Vertical 2D Various types of markers Line styles, thicknesses Drawn as Line, Curve 42
Area Charts Horizontal, Vertical 2D, 2D w/depth, 3D Stacked, Side-by-side Percent, Logarithmic Drawn as Line, Curve 43
Difference/Range Charts 2D. Curve or Straight lines. New Negative/Positive Fill also works for other types. 44
Meter Charts 2D, formatting control Regions, Needle styles, thicknesses 45
Gantt Charts 2D. Custom Bar width Custom Start/End Markers Data : Task ID / Start Date, End Date, Task Name 46
Bubble Charts 2D Custom Bubble shape – Square, triangle, diamond, star, icon… 47
Data Binding in Charts • Bind through Data Set • Bind through Report Element
Interactivity in Charts • Can jump to anchor points • Drill Through to other Reports • Interactivity through Javascript
Demo – Charting in Your Report Scenario: Mr. Ernie wants a report that is a simple listing of all products in the database, with the number of units in stock. Arrange the products for each Product Line and sorted the products in each product line in decreasing order of total inventory. Your boss would also like to only list those products with a minimum quantity in stock. Provide a report parameter to limit the output to those products with a quantity in stock greater than that specified in the report parameter. Add a Pie chart to this report to list products and their inventory.