Ad Hoc Reports

This topic covers the basics of deploying Ad Hoc reports, created with the OpenRPT report writer embedded in the xTuple client, using a Custom Command.

The Report

Below we see a preview of the report definition we are going to deploy called MYQOHByItem.

10_Goal.png

MetaSQL

Next we will look at the report's detail query and determine the MetaSQL parameter it uses to pass the user's input from the OpenRPT RTPrender application to the query. Below we see that the user will select an Item from RPTrender and its item_id value will be passed to the report's query to generate the report using the MetaSQL <? value("item_id") ?>.

10_item_id.png

Parameter Query

To make RPTrender easy for the end user to use, we can define a Parameter query in the report definition itself that RPTrender will execute when the user clicks the LIST button to display a list of selection options. In this case the list will contain Item Numbers concatenated with their Descriptions and sorted by Item Number.

It is important to note that the query can only contain two columns and the first column must always be the "_id" for the key field that will be passed into the report's queries through MetaSQL. The second column is what the user sees when the LIST button is pressed. So again, on RPTrender, the user will see Item Numbers concatenated with their Descriptions and sorted by Item Number. When one is selected from the list, the item_id for that Item will be passed through the MetaSQL parameter called "item_id" into the report's queries.

20_Param.png

The Custom Command

Now we create the Customer Command in xTuple that calls the RPTrender application and loads our report definition. Custom Commands are defined under System -> Design -> Custom Commands. We make the following entries:

On the Arguments tab we create three entries

40_CustCommand.png

Grant Privilege

Creating the custom command creates the privilege associated with it. To execute the Ad Hoc report, the user or the user's group must be granted the custom command's privilege. Below we see the association of the privilege for the ad hoc report with the group that is linked to multiple users.

50_Priv.png

Run Report from xTuple

The Custom Command we created associated our Ad Hoc report with the Inventory module. Below we see that it is executed under Inventory -> Custom.

50_Menu.png

RPTrender

Our Custom Command passed to the RPTrender application the server, port, DB, username and the report definition stored in the DB. The user simply enters the password.

60_Render_Logon.png

RPTrender List

Earlier in our report definition we defined a dynamic parameter query to lookup Items and their Descriptions and populate the MetaSQL Parameter "item_id" based on the entry the user selects after pressing the LIST button.

70_ListItems.png

Preview Report

The Print Preview button enables us to view the results of our report.

80_FinalReport.png

AdHocReports (last edited 2009-01-02 16:03:51 by ptyler)