If you are having trouble viewing this email, click here.

February 2008 Newsletter

That's Cool! RPG-XML Suite Tips & Tricks for Developers
by Aaron Bartell

The RPG-XML Suite developers at Krengel Tech have been at it again!  One developer mentioned previously that if management continues to provide hospital grade IV's for his coffee, cool XML usage scenarios will continue to be developed. Needless to say management complied and also bought the coffee beans :-)

This month we will be looking at how one can create crazy cool looking charts in the browser using XML feeds generated by RPG-XML Suite.  We actually stumbled across an Adobe Flex 3 article earlier this week and couldn't help but dig in and see how the innards of Flex work.  The original article (not written by us) can be found here: http://www.infoq.com/articles/web-flex-port.  Feel free to read through that article to gain understanding of what they were trying to accomplish.

Before we elaborate further, let's skip to the end and show you the result.  The following link shows the chart example running on Krengel Tech's iSeries: http://red.rpg-xml.com/flex/flexdash.html.  Click on the pie chart to see the animation. Pretty cool, eh?

There were a couple of steps involved in order to get the Flex application running based on XML coming from the iSeries.  First, we had to be able to recompile the Flex Action Script because the URL's included with the example were pointed at "localhost" and that definitely needed to be modified.  There are two approaches to compiling Flex, the first is to download their free command line compiler and the second is to download their Eclipse based IDE (named Flex Builder 3) and have it do the compiling automatically for you.  We went for the command line compiler first, but there appears to be some classes lacking in the included SDK files, so we jumped right over to the Eclipse IDE which can be downloaded here : http://www.adobe.com/products/flex/

Flex operates off of an MXML file that contains Action Script code and other markup tags that define things like pie charts.  You compile this file to get what's called an SWF file, which a Flash Player in the browser can open and render.  Note that Flash Players are pre-loaded into most browsers these days, so this isn't a huge concern.  You can see my MXML file at the following URL: http://red.rpg-xml.com/flex/flexdash.mxml.  If you do a 'Find' on that page for 'Krengeltech' you will see the three lines of code we changed to make it point at our iSeries.

Now, all that's left for me to do is create some XML feeds from our iSeries that the compiled Flex application will read in and render as charts.  To do this we simply copy and paste the XML included in the original articles download and created an RPG-XML Suite template file from it (located at /www/myrxs/templates/flexdash.tpl).  Then we created a physical file NAMVAL to hold chart information so you could see how to populate this chart based on database values vs. hard coding.  Note that NAMVAL is very simplistic and for example only.  Normally one would pull from a variety of business-minded tables to get this information.  Last we created an RPG-XML Suite program named FLEXDASH and compiled it into MYRXS.  All of the iSeries resources can be found in a document at this URL: http://www.rpg-xml.com/2008EmailCampaigns/080226/flexdash_iseriesresources.html

We had a lot of fun putting this together.  Hopefully this example presents yet another use for RPG-XML Suite in your shop to gain additional ROI.  Stay tuned for many more practical RPG-XML Suite uses in upcoming newsletter editions! 

If your company has a need to generate something similar, please contact Jeff Skistad @ jeff@krengeltech.com or 612-216-1808 to discuss our professional services availability.

Copyright © 2007 Krengeltech, Inc.