RLIB: report generation engine

Rlib is a report writing engine that takes report specifications in an XML language. It emits reports in several formats including HTML and PDF.

Visit RLIB

I stumbled across RLIB while figuring out how to implement some MS Access report writing features in PHP. MSA users will know what writing a report is, but PHP coders probably don't, so I'll explain.

Reports are like SQL queries, except they include features like grouping, summing, averaging (and other aggreate functions). They include breaking up a report into sections and pages, and adding headers to each.

Typically, people try to do the entire report in SQL, with a few queries, or they write loops in PHP (or whatever language) to do the summations and other features.

This works well for web pages, which are simple reports.

This gets pretty tedious, and, eventually, you end up with report writing engines, which take a query, a spec, and spit out a table with a sum at the end, or a hierarchical report with grouping, or whatever.

These reports are adequate for administration screens that require more comprehensive views of the data.

You can get pretty far with a simple report-generation engine, but more complex reports like MS Access' are out of reach -- mainly because you want to include HTML with the spec. You can't really make large, multi-page reports with a few levels of grouping, aggregate data for groupings, and page headers and footers.

You don't want to use a general templating language like PHP because you end up writing loops. Loops are simple, but they should be superfluous -- if you want to group by a column's values, you should be able to specify that, and not write a loop. This saves code, time, and debugging. (Debugging reports is tedious - you need to bring out the calculator or spreadsheet and do the calculations manually.)

So, you need a way to specify a report, to make it a complex report with grouping, and some way to include formatting information. You want to avoid writing loops, iterating over anything, or working with other fine-grained objects. This is going to end up being a domain-specific language, and XML is a reasonable syntax.

That's how I ended up finding RLIB.

It looks really nice - it has all kinds of features to perform aggregate operations. It uses XML and SQL as inputs, and produces many different formats for output. I'm going to start using it.

There are some big negatives, though:

* No release in 3 years, so it looks dormant. Development seems to be continuing on it, but, releases are old.

* There's PHP integration but it's not part of the standard PHP distro, so you need to compile PHP manually. This excludes thousands of web hosts.

* The library hasn't been packaged for Debian, or included in FreeBSD's Ports. I don't see any Windows integration, but I may be wrong (it uses MinGW, which is a pain to set up).

* It seems to lack a feature to insert a link into the report. This would be useful for a "drill down" feature in HTML reports. (Well, it would be useful to me for writing admin screens!)

The big positive, however, is that it's cheap (even the commercial license isn't too expensive), and looks pretty easy. It's not Crystal Reports, but, that's a whole other market. That's basically $400 per seat, while this is server-based and requires only a single install.