How to Get Started with Flash Charts using RPG
Alex: Welcome to Profound Logic TV and joining me today is Alan Smith, an RPG developer at Profound Logic. Now come to think of it RPG has probably been around before you were even born.
Alan Smith: I think you’re right Alex and since they started doing well development on the iSeries I realized pretty quickly why the language is still around today and hasn’t been replaced by newer one.
Alex: And why do you think that is?
Alan Smith: Well, it’s pretty much everybody knows in RPG creating your data and running business logic, it’s all like second nature and I think that what makes it a perfect fit for business applications on the web.
Alex: Alright, very completely.
Alan Smith: So back in the day the user was limited to the green screen for our user interface and that’s just not the case anymore. We have IRA, Ajax, Flash charts and graphs and all those things to use today.
Alex: And speaking of flash charts and graphs. I know there has been an increased usage of those in RPGCGI lately and then now you’ve been involved in projects that utilize graphs and charts a lot and the way too. Would you mind showing our viewers how to get started with flash charts using RPG?
Alan Smith: Not at all. You know all you really need is a set of Flash files that a lot of times are included in development tools and what I can do is show an example of one of that set that I’ve been working with on RPG’s iCheck, let’s check it out.
So we’ll start by creating a simple html page with some JavaScript to MetaFlash object. We need to specify the type of chart to create and the type we’ll be making is a 3D column chart. So let’s have a look at the RPGCGI code for chartdata.pgm. The program that provides the data of the chart objects. This page is really similar to Ajax response pages we created in some of our previous videos but instead of a plain text through adjacent response this program is going to use xml to represent our data set.
So first we include sales P, monthly orders file and initialize our year variable to 2009 and we said the content type of the text xml and I’ll put our opening chart tag. Then we leave through each month of 2009 and with each other we output an xml note with the corresponding data.
For this type of chart each set note has two required attributes, name and value. The name attribute will be the month name from the database file and the value attribute will be the number of orders received during that month, then we output the closing chart tag and we’re done.
You can review the xml and make sure it’s valid by opening the chart data program in your browser. Now, let’s have a look at our chart. Then months up here across the x axis with their number of orders plotted on the y axis and that’s how you created database driven chart with RPG.
Alex: That seems like a pretty straightforward way to make a database driven chart from RPG, thank you Alan.
Alan Smith: Sure thing, Alex.
Alex: For more educational videos please be sure to visit www.profoundlogic.tv.
Transcription by:
Scribe4you Transcription Services