Report Methods (MorphX Reporting Tools)
Important
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
You can override a report method in the Application Object Tree (AOT). To override a report method in the AOT, click the report to expand its node, right-click the Methods node, and then click Override Method. To add a report method in the AOT, click the report to expand its node, right-click the Methods node, and then click New Method.
Note
Whenever possible, write your code in the underlying table instead of in the report. Methods written in a table are available to any report that uses that table as a data source.
Methods That Can Be Overridden
Each report in the AOT has child nodes named Data Sources and Designs. These nodes have references to the member objects of the report. They can be manipulated in overridden methods.
The following table describes the report methods that you can override.
Method |
Description |
---|---|
callMenuFunction |
A Web method. |
caption |
Creates a caption when previewing a report, or a document name when printing a report. |
createProgressForm |
Called when the fetch method is being executed. This presents a progress indicator to the user, which is visible until all the data has been fetched and can be displayed. For reports that are only one page long, the progress indicator does not appear. This method opens the SysPrintProgress form. You can override this method to use a different form. |
dialog |
Does nothing. This method can be overridden to add fields to the Reports dialog box. |
fetch |
Fetches records from the database. The fetch method instantiates a query, opens the query prompt, and then fetches the records. During the execution of the fetch method, the next and get methods are executed in pairs on the query of the report. The send, the header and/or footer methods, and the progressInfo method are then executed. The cycle continues with calls to next, get, and so on, until all the data has been fetched. The following are reasons for overriding the fetch method:
For more information, see How to: Override the fetch Method to Filter Data for Reports (MorphX Reporting Tools). |
footer |
If overridden, you can execute code before, after, or instead of printing the footer of the report. |
getDeclineOverwrite |
Determines whether to overwrite the existing output file when a user tries to save the report. This method is called by the form. |
getReportViewer |
Gets a ReportViewer instance. |
getTarget |
Called by the SysPrintForm form when a user changes the print medium. Use the return value to detect the selected print medium. |
header |
If overridden, you can execute code before, after, or instead of printing the header of the report. |
init |
Initializes the report and its objects. This is the earliest method that can be overridden among those executed when a report is constructed and run. Override this method to add initialization tasks, such as the following:
If your changes require access to the objects of the report, add your code after the super() call. Warning Do not delete the super() call from this method. The super() call initializes all the objects of the report. |
new |
Used to instantiate an instance of the ReportRun class. The new method is a constructor. |
pack |
Packs the report into a container. The pack method returns the container. This method can be overridden to reduce the amount of the report that is packed. The packed report can then be sent between the client and server platforms, unpacked, and executed. The ReportRun class has several methods that are marked final. They are named in the patterns of pack* and unpack*. |
pageFormatting |
Displays the printer properties of the actual printer. However, the pageFormatting method is obsolete and is no longer used. Calls are made instead to this method on the PrintJobSettings class. |
Prints the report to the selected print medium, such as a printer, file, or screen. |
|
printerSettings |
Enables the user to select printer settings. Executes when Printer Settings is selected in the shortcut menu or in the SysPrintForm form. |
progressInfo |
Updates the progress form with page and line numbers. Override this method to add another progress indicator of the report evaluation progress. |
prompt |
Prompts the user to select a print medium and other information. Available mediums include paper, the screen, a print archive, .rtf, HTML, ASCII, .pdf, and text (UTF-8). To disable the print medium selection, override the method, and then remove the call to super(). Warning Do not mistake this method for the method of the same name on a query. |
run |
Runs the report. This method is executed when the user clicks OK on the preliminary specification dialog box of the report (which enables the user to select where to send the report, and so on). The default version of this method does the following in the sequence shown:
|
send |
Sends one fetched record to the body sections in the report. Override this method if you want to change each record, but you do not want to override the fetch method. The send method calls the progressInfo method. |
setTarget |
Executed by the SysPrintForm form when the print medium is changed. Use this method to select the print medium or the return value to detect the selected medium. |
showMenuFunction |
A Web method. |
showMenuReference |
A Web method. |
title |
Gets or sets the title of the report. |