Thursday, April 30, 2009

MQL Query DataTable

In this post, I will continue with some of the great things that you can do with Pentaho and YUI.

Do you have the need to add new fields to a table without writing code? By leveraging the Pentaho metadata services, it is easy.

First of all, grab the files off google code.
-MQLAction.html - This file can really be placed anywhere under the webapps/pentaho directory, but I recommend right under the pentaho directory. The html file just loades the MQLAction.js.
-MQLAction.js - The MQLAction.js file will dynamically load all the needed components using YUI Loader. The loader will get yui and non-yui files. It is a fabulous tool as it also grabs the yui css files.
-TaskNode.js - Create by the YAHOO team, this subclasses the TextNode and allows the handy checkbox feature.
-MetadataTree.js - The tree is formed by calling the Pentaho servlet AdhocWebService. If you update the metadata.xmi file on the platform this tree dynamically updates. For the purposes of this demo, I have hard-coded the solution of steel-wheels and the model BV_ORDERS. That can be changed or in other solutions, I have a model drop-down list.
-MetadataTable.js - The table takes the selected nodes from the tree and calles the mqlAction.xaction to get the results in JSON format.
-DataAction.jsp - The is a utility servlet that wraps any Pentaho xaction with JSON, html, or text. In this case we use JSON for easy JavaScript usage.
-mqlAction.xaction - Generic xaction that will run whatever bit of MQL that is passed to it. It can handle selections, conditions, and orders. the solution, model and distinct are also passed as parameters.

Next, go get the yui platform and ensure it is in webapps/pentaho/yui

If you are able to use these file or have anothe approach for dynamic reporting, let me know.

At this time, you cannot save the datatable, but there is always tomorrow.

6 comments:

Suresh Kumar V said...

mqlAction.xaction is missing in MQLTable.zip file. Kindly update the same

Andy Grohe said...

I have uploaded another archive with this and other xactions that I use in the cuc.

Chuck said...

Where can I get DataAction.jsp? I'm not seeing it in the archives you've linked to. Thanks

Andy Grohe said...

Chuck,

You can get it here.
http://code.google.com/p/pentaho-addon/downloads/list

However, I have switched to using ServiceAction delivered with Pentaho and parsing the XML.

You can also use the new CDA features to do the same.
http://code.google.com/p/pentaho-cda/

Chuck said...

Nevermind, I found it here: http://code.google.com/p/pentaho-addon

Thanks.

Chuck said...

Ha. Disregard my last reply. I made it before I saw your response. Thanks for the info!