Getting Started
All you need to get your first generated BIRT report is contained in this chapter. Detailed information about the introduced approaches can be found in the following chapters. As prerequisite you need a Fabasoft Folio installation with Fabasoft app.ducx. More information about Fabasoft app.ducx can be found in the white paper “An Introduction to Fabasoft app.ducx”.
Create a new app.ducx project (in this case BIRT@1.506) with an object model, a use case and a user interface file. Additionally create a BIRT report design file (report.rptdesign) and put it in the resources folder of the app.ducx project.
The following example defines an object model for a simple logbook management. With a context menu command a report for the logbook management can be created. To keep this first example as simple as possible the source XML data is hard-coded and the demo BIRT report design can be found in chapter “Eclipse BIRT Demo Report Design”. How to generate XML data from Folio properties is described in chapter “Generating the Source XML”. A brief introduction to the Eclipse BIRT Report Designer is provided in chapter “Creating a Report With Eclipse BIRT Report Designer”.
Example |
---|
app.ducx Object Model Language objmodel BIRT@1.506 { import COOSYSTEM@1.1; // creates an object with the BIRT report design as content instance FSCBIRT@1.1001:RPTDesign BirtReport { content = file("resources/report.rptdesign"); } // a logbook management may contain several logbooks class LogbookManagement : CompoundObject { compound = true; common = true; unique Logbook[] vmlogbooks { child = true; } } // a logbook has a description and may contain several trip logs class Logbook : CompoundObject { compound = true; common = true; string[] logdescription; unique TripLog[] logtriplogs { child = true; } } // defines data of a trip class TripLog : BasicObject { datetime trlfrom; datetime trluntil; unsigned float(6,1) trlmiles { init = 0.0; } } } app.ducx Use Case Language usecases BIRT@1.506 { import COOSYSTEM@1.1; import FSCVAPP@1.1001; import FSCVENV@1.1001; import FSCVIEW@1.1001; import FSCEXPEXT@1.1001; import COOMAPI@1.1; import FSCACROBAT@1.1; menu usecase CreateBirtReport on selected { variant Object { impl = expression { // a demo XML string xmlstr = "<data><objname>Logbook Management</objname><logbook id='COO.1.506.1.1002523'><objname>First Logbook</objname><logdescription>Description first logbook</logdescription><logtriplog><objname>First Trip Log</objname><trlfrom>2011-12-15T09:00:00</trlfrom><trluntil>2011-12-15T10:10:00</trluntil><trlmiles>10</trlmiles></logtriplog><logtriplog><objname>Second Trip Log</objname><trlfrom>2011-12-16T14:00:00</trlfrom><trluntil>2011-12-16T16:30:00</trluntil><trlmiles>20</trlmiles></logtriplog></logbook><logbook id='COO.1.506.1.1002527'><objname>Second Logbook</objname><logdescription>Description second logbook</logdescription><logtriplog><objname>Trip Log 1</objname><trlfrom>2011-12-19T23:00:00</trlfrom><trluntil>2011-12-20T04:00:00</trluntil><trlmiles>600</trlmiles></logtriplog><logtriplog><objname>Trip Log 2</objname><trlfrom>2011-12-22T15:00:00</trlfrom><trluntil>2011-12-22T16:00:00</trluntil><trlmiles>40</trlmiles></logtriplog></logbook></data>"; content xmlcont = coort.CreateContent(); xmlcont.SetContent(cootx, 1, 65001, xmlstr); // creates the report content result = coouser.FSCBIRT@1.1001:CreateReport (xmlcont, #BirtReport)[3]; // PDF object containing the report FSCACROBAT@1.1:PDFObject pdf = #FSCACROBAT@1.1:PDFObject.ObjectCreate()[2]; pdf.content = result; pdf.content.contextension = "pdf"; pdf.objname = "Report " + coort.GetCurrentDateTime(cooobj); cooroot.ObjectLock(true, true); cooroot.objchildren += pdf; } } } } app.ducx User Interface Language userinterface BIRT@1.506 { import COOSYSTEM@1.1; import COOATTREDIT@1.1; import COODESK@1.1; import COOSEARCH@1.1; import FSCVAPP@1.1001; // defines a context menu entry for the LogbookManagement object class to // be able to generate a report extend class LogbookManagement { menus { default = { expansions { MenuContextExpansion { entries = { MenuCreateBirtReport } } } } } } } report.rptdesign // see chapter "Eclipse BIRT Demo Report Design" |
To get your first report, perform the following steps:
- After you have compiled and run this project create a new “LogbookManagement” object.
- Open the context menu of the logbook management and execute “MenuCreateBirtReport”.
A PDF report based on the demo XML is generated and is put on the desktop.
To generate the report, the use case FSCBIRT@1.1001:CreateReport is used. Detailed information about this use case can be found in the next chapter.
Next steps: