Pentaho8ReportingforJavaDevelopers
Createpixel-perfectanalyticalreportsusingreportingtools
FrancescoCorti
BIRMINGHAM-MUMBAI
Pentaho8ReportingforJava
Developers
Copyright©2017PacktPublishingAllrightsreserved.Nopartofthisbook
maybereproduced,storedinaretrievalsystem,ortransmittedinanyformorby
anymeans,withoutthepriorwrittenpermissionofthepublisher,exceptinthe
caseofbriefquotationsembeddedincriticalarticlesorreviews.
Everyefforthasbeenmadeinthepreparationofthisbooktoensuretheaccuracy
oftheinformationpresented.However,theinformationcontainedinthisbookis
soldwithoutwarranty,eitherexpressorimplied.Neithertheauthor,norPackt
Publishing,anditsdealersanddistributorswillbeheldliableforanydamages
causedorallegedtobecauseddirectlyorindirectlybythisbook.
PacktPublishinghasendeavoredtoprovidetrademarkinformationaboutallof
thecompaniesandproductsmentionedinthisbookbytheappropriateuseof
capitals.However,PacktPublishingcannotguaranteetheaccuracyofthis
information.
Firstpublished:September2017
Productionreference:1120917
PublishedbyPacktPublishingLtd.
LiveryPlace
35LiveryStreet
Birmingham
B32PB,UK.
ISBN978-1-78829-899-5
www.packtpub.com
Credits
Author
CopyEditor
FrancescoCorti
SafisEditing
Reviewers
ProjectCoordinator
RubenOlivaRamos
NidhiJoshi
JuanTomasOlivaRamos
CommissioningEditor
Proofreader
AmeyVarangaonkar
SafisEditing
AcquisitionEditor
Indexer
VirajMadhav
TejalDaruwaleSoni
ContentDevelopmentEditor
Graphics
CherylDsa
TaniaDutta
TechnicalEditor
ProductionCoordinator
DineshPawar
ArvindkumarGupta
AbouttheAuthor
FrancescoCortiisanenthusiasticconsultantinsoftwaresolutionsandloves
workingindeveloper,sales,andcustomersteams.Proudoftheroleofasoftware
engineer,heisofteninvolvedinpre-salespresentations,publicspeaking,andIT
courses.Developingsoftware,designingarchitectures,anddefiningsolutionsin
ECM/BPMandBIarehisfavoriteareasofinterest.Hehascompleteddozensof
projects,fromverysmallonestomorecomplexones,inalmost20yearsof
experience.
AproductevangelistatAlfresco,Francescorepresentsthefamousopensource
ECMinthedevelopercommunity.Inadditiontohelpingdevelopersadopt
Alfrescotechnologies,heoftenhelpsAlfrescotoimprovethedeveloper
experiencethroughtalks,articles,blogging,userdemonstrations,recorded
demonstrations,orthecreationofsampleprojects.
HeistheinventorandprincipaldeveloperofAlflytics(previouslynamed
AlfrescoAuditAnalyticsandReporting),themainbusinessintelligencesolution
overAlfrescoECM,entirelybasedonthePentahosuite.Heauthoredthe
PentahoReportingvideocoursewithmorethan40videosandcoursesonthe
PentahoReportingDesignerandSDK.
Francescohasspecialtyandprincipalexperiencesinenterprisecontent
managementsolutionswithAlfrescoECMandHylandOnBase(heisanOnBase
certifiedinstaller);businessprocessmanagementsolutionswithActiviti,JBPM,
andHylandOnBase;datacapturesolutionswithEphesoft,HylandOnBase,and
customsoftware;recordmanagementsolutionswithO'Neilsoftwareandcustom
software(usingAlfrescoECMandHylandOnBase);andportaland
collaborationwithLiferayandMSSharePoint.
AbouttheReviewers
RubenOlivaRamosisacomputersystemsengineerfromTecnologicodeLeon
Institute,withamaster'sdegreeincomputerandelectronicsystemsengineering,
teleinformatics,andnetworkingspecializationfromtheUniversityofSalleBajio
inLeon,Guanajuato,Mexico.Hehasmorethan5yearsofexperiencein
developingwebapplicationstocontrolandmonitordevicesconnectedwith
ArduinoandRaspberryPiusingwebframeworksandcloudservicestobuildthe
InternetofThingsapplications.
HeisamechatronicsteacherattheUniversityofSalleBajioandteaches
studentsofthemaster'sdegreeindesignandengineeringofmechatronics
systems.RubenalsoworksatCentrodeBachilleratoTecnologicoIndustrial225
inLeon,Guanajuato,Mexico,teachingsubjectssuchaselectronics,roboticsand
control,automation,andmicrocontrollersatMechatronicsTechnicianCareer;he
isaconsultantanddeveloperforprojectsinareassuchasmonitoringsystems
anddataloggerdatausingtechnologies(suchasAndroid,iOS,WindowsPhone,
HTML5,PHP,CSS,Ajax,JavaScript,Angular,andASP.NET),databases(such
asSQlite,MongoDB,andMySQL),webservers(suchasNode.jsandIIS),
hardwareprogramming(suchasArduino,Raspberrypi,EthernetShield,GPS,
andGSM/GPRS,ESP8266),andcontrolandmonitorsystemsfordata
acquisitionandprogramming.
HehasauthoredthebookInternetofThingsProgrammingwithJavaScriptby
PacktPublishing.Heisalsoinvolvedinmonitoring,controlling,andthe
acquisitionofdatawithArduinoandVisualBasic.NETforAlfaomega.
Iwouldliketothankmysaviorandlord,JesusChrist,forgivingmethestrength
andcouragetopursuethisproject;mydearestwife,Mayte;ourtwolovelysons,
RubenandDario;mydearfather,Ruben;mydearestmom,Rosalia;mybrother,
JuanTomas;andmysister,Rosalia,whomIlove,foralltheirsupportwhile
reviewingthisbook,forallowingmetopursuemydream,andtoleratingnot
beingwiththemaftermybusydayjob.
JuanTomasOlivaRamosisanenvironmentalengineerfromtheuniversityof
Guanajuato,withamaster'sdegreeinadministrativeengineeringandquality.He
hasmorethan5yearsofexperienceinmanagementanddevelopmentofpatents,
technologicalinnovationprojects,anddevelopmentoftechnologicalsolutions
throughstatisticalcontrolofprocesses.Heisateacherofstatistics,
entrepreneurship,andtechnologicaldevelopmentofprojectssince2011.Hehas
alwaysmaintainedaninterestfortheimprovementandtheinnovationinthe
processesthroughthetechnology.Hebecameanentrepreneurshipmentorand
technologymanagementconsultantandstartedanewdepartmentoftechnology
managementandentrepreneurshipatInstitutoTecnologicoSuperiordePurisima
delRincon.
HehasworkedonthebookWearableDesignsforSmartWatches,SmartTVs
andAndroidMobileDevices.
Hehasdevelopedprototypesthroughprogrammingandautomationtechnologies
fortheimprovementofoperations,whichhavebeenregisteredforpatents.
IwanttothankGodforgivingmethewisdomandhumilitytoreviewthisbook.I
wanttothankRuben,forinvitingmetocollaborateonthisadventure.Ialso
thankmywife,Brenda,ourtwomagicprincesses,ReginaandRenata,andour
nextmember,Tadeo.Allofyouaremystrengthsandhappiness,andmydesireis
tobeforthebestforyou.
www.PacktPub.com
Forsupportfilesanddownloadsrelatedtoyourbook,pleasevisitwww.PacktPub.co
m.DidyouknowthatPacktofferseBookversionsofeverybookpublished,with
PDFandePubfilesavailable?YoucanupgradetotheeBookversionatwww.Packt
Pub.comandasaprintbookcustomer,youareentitledtoadiscountontheeBook
copy.
Getintouchwithusatformoredetails.Atwww.PacktPub.com,
youcanalsoreadacollectionoffreetechnicalarticles,signupforarangeof
freenewslettersandreceiveexclusivediscountsandoffersonPacktbooksand
eBooks.
/>
Getthemostin-demandsoftwareskillswithMapt.Maptgivesyoufullaccessto
allPacktbooksandvideocourses,aswellasindustry-leadingtoolstohelpyou
planyourpersonaldevelopmentandadvanceyourcareer.
Whysubscribe?
FullysearchableacrosseverybookpublishedbyPackt
Copyandpaste,print,andbookmarkcontent
Ondemandandaccessibleviaawebbrowser
CustomerFeedback
ThanksforpurchasingthisPacktbook.AtPackt,qualityisattheheartofour
editorialprocess.Tohelpusimprove,pleaseleaveusanhonestreviewonthis
book'sAmazonpageat />Ifyou'dliketojoinourteamofregularreviewers,youcanemailusat
WeawardourregularreviewerswithfreeeBooksand
videosinexchangefortheirvaluablefeedback.Helpusberelentlessin
improvingourproducts!
Dedicatedtomywife,Natalija
TableofContents
Preface
Whatthisbookcovers
Whatyouneedforthisbook
Whothisbookisfor
Conventions
Readerfeedback
Customersupport
Downloadingtheexamplecode
Downloadingthecolorimagesofthisbook
Errata
Piracy
Questions
1.
IntroductiontoPentahoReporting
IntroducingPentahoReporting
IntroducingPentahoReportingtools
Typesofusersandrequiredknowledge
Technologicaladvantages
Abusinessfriendlyopensourcelicense
TypicalusesofPentahoReporting
Operationalreporting
Businessintelligencereporting
Financialreporting
Productionreporting
PentahoReportinghistory
Featureoverview
Anadvancedreportingalgorithm
Amultitudeofavailabledatasources
Awidevarietyofoutputformats
Pixelaccuraterichformatting
Embeddedcharts
Reportparameterization
Formulasandstyleexpressions
Subreports
Crosstabreports
Interactivereporting
Richauthoringtools
Reportingserver
JavaAPIforbuildingreports
Extensibility
Pentahoreportingwebsite
PentahoReportingarchitecture
ReportingEngine'slibraries
ReportingEnginecore
ReportingEngineextensions
Summary
2.
GettingStartedwithReportDesigner
Prerequisitesofyourenvironment
SettingupthePentahoReportDesigner
TheSamplaDataschema
Introductiontotheuserinterface
Menuandtoolbar
Reportelementpalette
Reportcanvastab
Reportexplorer
Elementproperties
Messages
Creatingyourfirstreportusingthewizard
IntroducingtheReportDesignWizard
Definingthelookandfeel
Definingthedatasourceandquery
Definingthelayout
Formattingthefields
Previewingthereport
Savingandopeningthereport
Summary
3. GettingStartedwithReportingSDK
ObtainingthePentahoReportingSDK
AnatomyofthePentahoReportingSDK
UsingtheincludedEclipseproject
Introducingtheincludedexamples
CreatingawebapplicationusingPentahoReportingandMaven
Prerequisitesofyourenvironment
CreatingawebapplicationinJava
CreatingaJavawebapplicationusingApacheMaven
CreatingthefirstpageoftheJavawebapplication
IncludingPentahoReportingEngineinawebapplication
AddingthePentahorepository
AddingthePentahodependencies
ShowinganexistingPentahoreportinawebapplication
IncludinganexistingPentahoreport
IncludingtheSampleDataschema
UpdatingthePentahoServlet
PreviewingthePentahoreport
Summary
4.
CreatingaReportwithReportDesigner
CreatingaPentahoreport
CreatinganewPentahoreport
CreatingadatasourceinPentahoreports
AddingdetailstoPentahoreports
PreviewingandsavingaPentahoreport
CustomizingPentahoreports
Customizingthefont
Customizingthereportheader
Addingthedetailsheaderandcustomizingthedetails
Customizingthepagefooter
Groupingthedetails
Addingcharts
PreviewingPentahoreportsindifferentformats
Trainyourselftolearnfaster
Summary
5.
DesignandLayoutinReportDesigner
ReportDesigneruserinterfacecomponents
TheStructuretabinreportexplorer
Thereportelementproperties
Masterreportandreportbandsproperties
Commonproperties
Sizeandpositionproperties
Font,text,andtext-spacingproperties
Fontproperties
Textproperties
Text-spacingproperties
Objectproperties
Linksproperties
Excelproperties
Page-behaviourproperties
Paddingproperties
Borderproperties
Commonpropertiesinattributes
Query-metadataproperties
Wizardproperties
HTMLproperties
Excelpropertiesinattributes
HTML-events,PDF-events,andSwing-eventsproperties
HTML-eventsproperties
Pdf-eventsproperties
Swing-eventsproperties
MasterReportproperties
Sizeandpositionproperties
Textproperties
Page-behaviourproperties
Queryproperties
Commonpropertiesintheattributestab
Wizardproperties
Excelproperties
Advancedproperties
Pentahoproperties
PageHeaderandPageFooterproperties
ReportHeaderandReportFooterproperties
GroupHeaderandGroupFooterproperties
Detailsbodyproperties
Watermarkproperties
Reportelements
Commonproperties
Sizeandpositionproperties
Fontproperties
Textandtext-spacingproperties
Rotationproperties
Objectproperties
Linksproperties
Excelproperties
Page-behaviorproperties
Paddingandborderproperties
Commonpropertiesinattributes
Query-metadataproperties
Wizardproperties
HTMLproperties
Excelpropertiesinattributes
HTML-event,pdf-events,Swing-eventsproperties
Labelandmessage
Fieldsandresources
Imageandimage-field
Vertical-line,horizontal-line,rectangle,andeclipse
Survey-scale
Chart
Simple-barcodes
Bar-sparkline,line-sparkline,andpie-sparkline
Band
Sub-report
Table-of-contentandindex
Hidingandshowingbands
VisuallayoutinReportDesigner
Thegrid
Guidelines
Additionalvisualindicators
Movingandaligningsingleelements
Aligninggroupsofelements
Miscellaneouslayoutcapabilities
PentahoReportDesignershortcutkeys
Considerationsfordifferentoutputformats
Celloutput
Paging
Limitstorichgraphicsandcharts
Summary
6. ConfiguringJDBCandOtherDataSources
Introducingdatasources
Datasetsinreportexplorer
TheJDBCdatasource
AddingoreditingaJDBCconnection
AbouttheJNDIaccess
Addingoreditingaquery
Themetadatadatasource
TheMongoDBdatasource
ThePentahoDataIntegrationdatasource
TheOLAPdatasource
Pentahoanalysis
OLAP4J
Pentahoanalysis-custom
TheXMLdatasource
Thetabledatasource
Theadvanceddatasource
Scriptable
External
Sequencegenerator
OpenERPdataaccess
ThePentahocommunitydataaccessdatasource
Summary
7. IncludingGraphicsandChartsinReports
Includingstaticimagesinreports
Includingdynamicimagesinreports
Includingchartsinreports
Typesofdatasets
Categorydataset
Commonproperties
Seriesproperties
Groupproperties
Optionalproperties
Piedataset
XYseriesandXYZseriesdataset
Timeseriesdataset
Thermometerdataset
Styleandlayoutcommonproperties
Requiredproperties
Titleproperties
Generalproperties
Legendproperties
Scriptingproperties
Barchart
Barchartexample
Linechart
Linechartexample
Areachart
Areachartexample
Piechart
Piechartexample
Multipiechart
Multipiechartexample
Barlinechart
Barlinechartexample
Ringchart
Ringchartexample
Bubblechart
Bubblechartexample
Scatterplotchart
Scatterplotchartexample
XYbarchart,XYlinechart,andXYareachart
XYbarchart,XYlinechart,andXYareachartexamples
ExtendedXYlinechart
ExtendedXYlinechartexample
Waterfallchart
Waterfallchartexample
Radarchart
Radarchartexample
XYarealinechart
Thermometerchart
Thermometerchartexample
Includingsparklinechartsinreports
Summary
8.
Parameterization,Functions,Variables,andFormulas
Reportparameterization
Usingreportparameters
Theavailablereportparametertypes
Creatingparameters
Creatingareportusingparameters
Functionsandexpressions
FunctionsandexpressionsinReportDesigner
Creatingandusingfunctions
Exampleoffunction
Creatingandusingexpressions
Exampleofexpression
Theavailablefunctiontypes
Commonfunctions
Reportfunctions
Summaryfunctions
Runningfunctions
Advancedfunctions
Chartdataandvaluedatafunctions
Imagefunctions
Scriptfunctions
Tableofcontentsfunctions
Environmentvariables
Workingwithformulas
Creatingaformula
Theformulasyntax
Formuladatatypes
Formulaoperators
Theavailableformulacategories
Dateortimeformulas
Databaseformulas
Informationformulas
Logicalformulas
Mathematicalformulas