Modernizing With PHP Grid Tools
This year being the 25th anniversary of the birth of our beloved IBM i, we thought it might be an appropriate time to get back to the topic of modernization. As those of you who have read any of our previous columns on this subject will know, we’re big fans of anything that will help maximize returns while minimizing effort. That means finding tools that help us get things up and running quickly.
Why do we feel this is so important? Because we’ve seen so many companies’ modernization efforts stumble at the starting line while their RPG team continues to try to select the “perfect” tool. We have a very simple mantra when it comes to modernization:
“The only thing you can do wrong is to do nothing.”
Don’t waste time trying to find the perfect tool—there isn’t one—and, more importantly, there never will be. You should certainly evaluate more than one tool before making a final decision, but for many, the pressures of daily work will cause that effort to move exceedingly slowly.
What we often recommend to our clients is not to start by attempting a massive modernization of their existing applications, but rather “nibble away” around the edges to gain experience. For example, convert a few print reports to the Web. This is a great first Web project, and typically a relatively easy task with a high user satisfaction payback. For details of one approach to this task, check out our article “Webulating Printer Output Revisited.”
Another option is to use one of the free/low-cost tools available to give your users the new Web-based reporting they’ve requested. A good reason for taking this approach is that until you put something in front of the users they don’t know what to request! Once they have something to look at and play with they can begin to tell you what they really need. Otherwise all too often it becomes a case of the blind leading the blind. Trust us—your efforts will be much more productive if you start by taking baby steps.
Back in late 2011 we blogged about one tool that can help you to get started—Planet J’s WOW Community Edition.
In recent weeks we have also come across two new PHP-based tools that, with minimal work, can really be an eye opener for those in your organization who think IBM i can’t do this kind of thing. They are phpGrid and iDataGrid. The results produced by the two can be very similar, as the images you’ll see below will show you. But they work in very different ways.
A quick look at the company’s website shows you that it has some pretty big-name clients ranging from Cisco to Bank of America and even the Government of Canada (Nice to see our tax dollars put to such good use!). The product comes in multiple versions each of which offers different capabilities. At the bottom end of the scale comes phpGrid Lite. This is the one we used for our examples. It’s free but has two significant restrictions. The free version can’t produce grids that provide editing capabilities and it can only use MySQL (i.e., ZendDbi) tables. Of course since we have the DB2 storage engine available to us, even this basic version can produce reports of DB2 data, but you should bear this limitation in mind. We should point out however that you can remove both of these restrictions by paying the massive sum of $195 (no, that’s not a mistype) for the Professional version, which includes six months of free updates and support.
So when we say “minimal coding” exactly what do we mean? Well is this “minimal” enough for you?
$dg = new C_DataGrid("SELECT customerNumber, customerName, city,
state, country from customers", "customerNumber");
$dg -> display();
Figure 1 is the Web page it produces. We think you’ll agree that’s quite impressive for such a minimal amount of code.
Now we confess that we cheated just a little bit here. The code as shown would not have provided for exporting to Excel. To implement that required the addition of this line prior to the invocation of the display() method:
$dg -> enable_export();
One other thing you may notice is that while column sorting is implemented in this grid (witness the upward pointing arrow alongside the customerName column heading) the column headings themselves have defaulted to the column names in the customers table. This is easy to deal with by simply adding a few more calls to the appropriate methods. Figure 2 is another version of that same grid that adds additional functionality.