How to Create a Complex Report Dialog Form

Let’s assume that we need to create the report dialog form for the List of purchase orders report, which looks like as shown on the picture below.

The needed artifacts for each Basic report including the List of purchase orders report are:

  • Data Source Provider (DSP) class which provides the report data
  • Print Report Manager (PRM) class which defines Report ID and the report parameters, handles report execution from building and opening the report dialog form to printing the report to a selected print destination.
  • Report Menu Item which points to the report Print Report Manager (PRM) class. When opens the main()
    method of the PRM class is invoked. This will result in opening the report dialog form and afterwards printing the report.
The wizard generates most methods that can be overridden along with basic APIs and examples of use.

On the picture below is shown the PRM class which created by the wizard. In the class declaration we additionally prepared the macros and variables for the report parameter names and values that will be used by the class methods.

First, we will implement the addParameters() method in order to add all required report parameters.

By opening the Report Menu Item (CTRL+O), the report dialog form is shown. The form looks like this:

The default order of the parameter form controls on the report dialog form is the same as the sequence of adding the parameters in the addParameters() method. To change the default order, layout or to introduce groups for the parameter form controls on the report dialog form, you have to override the buildParameterFormControls() method of the report PRM class.

Let’s implement buildParameterFormControls() method of the report PRM class.

We can use FormBuildControl child classes (e.g. FormBuildGroupControl, FormBuildIntControl, FormBuildStringControl, FormBuildDateControl, FormBuildCheckBoxControl, FormBuildRadioControl, etc.) along to Docentric AX APIs (e.g. the buildSingleParameterFormControl() method of the base PRM class) to dynamically define how the dialog form of a report should look like.

We have changed the default parameter ordering and introduce two groups on the report dialog form. The form now looks like as required:

In order to modify the form controls bound to the report parameters on the report dialog form, we have to use the modifyParameterFormBuildControls() method of the PRM class. Use this method if the form controls' methods such as lookup() or modified() have to be overridden.

Let’s implement the modifyParameterFormBuildControls() method of the report PRM class to enable custom lookup() and modified() methods of the form control bound to the OrderAccount report parameter.

See also

Download This Example >>
Docentric Basic Report Execution Hooks Overview >>
How to Run a Report in the Context of an Underlying Entity >>
How to Use More Than One Template for a Report >>

IN THIS ARTICLE