DevExpress Reporting with Dynamics GP
In this tutorial, we’re going to walk through DevExpress integration with Dynamics GP step by step.
Our focus here is not so much the creation of the reporting application itself (see how we created ours here), but rather to demonstrate how to launch a DevExpress report from within Dynamics GP. This can be done either by creating a GP add-in, or by configuring a GP window to launch an executable file. In this tutorial, we’ve taken the latter approach, but wanted to mention the capability exists to create a full-featured reporting application.
By the end of this tutorial, we’ll be able to launch a WPF window from inside a GP window, passing data from Dynamics GP forms to the reporting application and generate and display a DevExpress report.
Our starting point for this tutorial is a WPF executable containing a window with a simple UI and a reference to a report class library. We've included this interface to demonstrate the interaction between .NET controls and the DevExpress XtraReports suite, though a report document can be generated directly from a Dynamics GP window as well.
Creating the Dexterity Code
To launch an executable file from a Dynamics GP window, you can create a Dexterity script, and call the script from a GP Window object's focus events. In this example, we call our script from the window's print event, but this could be modified to be called in another event just as well.
The Dex code is as follows:
There's a few things worth mentioning in this script. First, the path to the executable must be available in the Dynamics GP Dex.ini file. The Dex.ini file can be found wherever your GP program files are installed. From there, navigate to the Data directory (Data\Dex.ini).
In the Dex.ini file, set the name specified in your Defaults_Read method (see script above) to the path where your executable is located:
The parameters portion of the script is how we pass GP data to the reporting application. The parameters are passed as space separated string arguments, and will be parsed in our reporting application's AppStartup method.
Because the run application method only excepts string parameters, and Dexterity limits strings to 255 characters, the file path specified must be less than 255 characters long, as well as the total length of the command-line arguments.
Additionally, the error message addressing GP user not assigned to Project Cost user is due to the fact that we're launching the report from a window in our Project Cost module, and some users may not be properly configured as Project Cost users. This becomes an issue because the query used to retrieve data for the report cross-references a Project Cost security view in the GP company database using the user number generated from this mapping process.
Those using Dynamics GP without our Project Cost module can disregard this error check.
Once an executable has been created, the script has been added to the appropriate window event in the GP cnk file, and the Dex.ini variable has been set to the correct path, you will be able to launch a DevExpress report from a Dynamics GP window.