]po[ Developers: Reporting,Indicators & DashboardsFrank Bergmann, 2013-04-06This tutorial explains various options on how to extract anddisplay information from ]project-open[.
Different Typesof ReportsReporting is one of the most basic requirements for a business application.]project-open[ provides a large variety of different ways to display data withdiffering degrees of sophistication and complexity: Simple SQL Query in pgAdminIII or PSQL:Simply execute a SQL query using a PostgreSQL client outside of ]po[ MS-Access Report:You can store MS-Access reports in a ]po[ filestorage or even link to it using a “menu” MS-Excel Report:You can define the ]po[ database as a data-source for MS-Excel. im_ad_hoc_query $sql in /ds/shell:Useful for ad-hoc queries and for development. im_ad_hoc_query $sql in a TCL page:Easy way to deploy an ad-hoc query in a production system. You can also add a menu to thereporting section. Dynamic Report (Reporting -> New Report):Similar to ad-hoc query, but with built-in deployment. ]po[ HTML Reporting Engine:The ]po[ reporting engine allows for grouping, aggregation, sub-totals and grand totals. ]po[ OpenOffice “PowerPoint” Reporting Engine:This reporting engine allows to create OpenOffice Impress (PowerPoint) slides based on templates. Indicator:A special type of report that returns only a single numeric value. ]po[ takes care to regularly evaluatethe SQL query and to store the values to create a timeline. Histogram Chart:A histogram is a Portlet that takes a SQL query as an argument. The query needs to return rowswith Name – Value pairs. Data-Warehouse Cube:DW-Cubes may already cover your reporting needs. You can aggregate by drop-down type ofDynFields. Pie Chart based on DW-Cube:You can show a pie chart of the summary of a DW cube. Sencha Charts:You can setup a “cron” script to save report results as a static HTML page at night. Nightly Evaluation of Long Running Reports:You can setup a “cron” script to save report results as a static HTML page at night.
Simple SQL Query in pgAdminIII or PSQL pgAdminIII allows you to execute SQLqueries manually. pgAdminIII allows to save SQL queriesin .sql files Advantages:– Quick development– Integrated with tree-view tothe database, tables, views etc. Disadvantages:– Requires manual execution
MS-AccessReportYou can use Microsoft Access as a reporting engine: MS-Access can access the ]project-open[ PostgreSQL database without problems You can use all available MS-Access tools to developyour reports Advantages:– Comfortable development tools– Easy entry for beginners Disadvantages– Security issues if every computer has full access to thedatabase. As an alternative, you could report on certainviews only with restricted permissions.– Every computer needs a PostgreSQL ODBC installedlocally
MS-ExcelReportYou can use Microsoft Excel as a reporting engine: MS-Excel can access the ]project-open[ PostgreSQLdatabase without problems You can use all available MS-Excel tools to developyour reports, including pivot tables and Excel macros. Advantages:– Comfortable development tools– Easy entry for beginners– Excel allows for complex post-processing of data inseparate sheets– Pivot tables allow for data-warehouse like reports Disadvantages– Limitation of the number of rows– Security issues if every computer has full access to thedatabase. As an alternative, you could report on certainviews only with restricted permissions.– Every computer needs a PostgreSQL ODBC installedlocally
im_ad_hoc_query $sql in /ds/shell The ]project-open[/OpenACS /ds/shell pageallows developers to execute TCL commandsinteractively The “im_ad_hoc_query $sql” TCL commandtakes a SQL query and returns the results in“html”, “csv” or “plain” format Advantages:– Well suitable for ad-hoc queries– Integrated into ]project-open[– Working queries can be easily deployed (seelater reporting options) Disadvantages:– /ds/shell requires manual execution– im_ad_hoc_query does not support aggregationand parameters.
im_ad_hoc_query $sql in a TCL page Once your query is running in the /ds/shellenvironment, you can easily deploy the report asa ]project-open[ page. The example below shows how to include the“im_ad_hoc_query” statement into a “.ADP”page. You may then create a new menu item in the ]po[ reporting section (Admin -> Menus -> CreateNew Menu) in order to integrate the new reportinto the rest of the system. Advantage:– Easy deployment of reports developed in /ds/shell– Integrated with the rest of the ]po[ environment Disadvantages:– im_ad_hoc_query doesn’t support grouping andsub-totals– No security. You will have to add security checksmanually.
Dynamic Report (Reporting -> New Report) Administrators can create new reports inReporting -> New Report These “dynamic reports” behave just likeim_ad_hoc_query. Advantages:– Dynamic Reports automatically create a menuitem for you that links to the report and allow tomanage permissions– Dynamic Reports allow you to export the data inCSV format. Disadvantages:– Like all im_ad_hoc_query based reports: Nogrouping and sub-totals.
]po[ HTML Reporting Engine The ]po[ reporting engine allows tocreate arbitrarily complex reports ina style similar to MS-Access andCrystal Reports. Advantages:– Allows for group, sub-totals andtotals– Allows for parameters– Allows for different “Levels of Detail”– Allows for “drill-down”. Clicking onone of the [+] icons will show amore details view Disadvantages:– Requires considerable TCLprogramming skills
Indicators Indicators are a special type of “report”that only returns a single numeric value. ]po[ takes care to regularly evaluate theSQL query and to store the values tocreate a timeline. Indicators allow for permissions perindicator, so you can limit the visibility tocertain user groups. Advantages:– Allows to build management dashboards,balanced scorecards etc. Disadvantages:– Only suitable for certain reportingpurposes– It is very difficult to develop indicators thatare really relevant to a business.
Histogram Chart A histogram chart is a simple “PortletComponent” that takes a SQL query as aparameter. The query needs to return two columnsonly:– A name (here: ticket_type)– A number (here: count) Advantages:– Easy to develop– Easy to integrate into existing pages in ]po[ Disadvantages:– Limited reporting capabilities
Data-Warehouse Cube ]po[ includes an integrated Data-Warehouse as a commercial add-onpackage. “Cubes” are capable of aggregating dataalong many “dimensions”. Advantages:– One DW-cube can replace tens of separatereports.– DW-cubes allow the user to “slice and dice”data– DynFields (drop-down) can be used as“dimensions” in a DW. For example, a“Business Sector” DynField per customerwill automatically appear in the Financecube.– Seamlessly integrated into ]po[ Disadvantages:– Commercial package, license costs.– Only numeric values can be shown in a DW
Pie Chart Based on DW-Cube Pie charts can take a “sum”column of a data-warehousecube as a data-source. Advantages:– Easy creation of pie charts Disadvantages:– Data can only be extractedfrom existing DW-cubes.
NightlyEvaluation ofLong RunningReports Reports frequently can take several seconds oreven minutes to execute. One way to provide users with a more agile reply isto pre-evaluate reports (at night) and to provide theresults as a static HTML page to the user. The following command will execute the“report.adp” and store the results as a static HTMLpage:– wget http://localhost/report -o ~/www/report.html Advantages:– Fast response time– The static HTML page still provides drill-incapabilities. Disadvantages:– Extra effort to schedule the evaluation– Scheduling many reports may lead to overlaps atnight