2012年7月12日星期四

How to fix to report scaling and the report is empty message

When a report doesn't fit on a page, depending on it's properties Ax will resize the report. This is a powerful and very useful feature.
Now Ax will inform you that the report has been rescaled (Report is scaled xx percent to fit to page) and this message is generally not well received by users.




Users are annoyed by the message, they get it every time they run the report, they cannot do anything about it, they have to click to close the infolog, ...

Ax has a builtin feature to suppress this scaling message. You can modify the init method of your report, and add something like this:

this.printJobSettings().suppressScalingMessage(true);
this.printJobSettings().clientPrintJobSettings().suppressScalingMessage(true);

This is very effective and will do the job.
Only, this requires you to modify every report with these kind of messages.

A nicer way would be if we could switch it off in one place for all reports. Fortunately, this is possible as well.
Go to class SysReportRun, in the Run method, place following code before the call to super:

if(this.printJobSettings())
this.printJobSettings().suppressScalingMessage(true);

//this.printJobSettings().clientPrintJobSettings().suppressScalingMessage(true);
// VAR Changed on 06 Feb 2012 at 14:14:30 by JXie7519
void run(boolean onlyReport = false)
{
    // If this report is a webReport the run a webReport.
    if (webSession() && runBaseReport)
    {
        runBaseReport.runWebReport();
    }
    else
    {
        // When running the report and onlyReport = true then run the report.
        if (!onlyReport && runBaseReport)
        {
            if (runBaseReport.prompt())
            {
                runBaseReport.run();
            }
            // If the prompt returns false the do not run the report.
            // The RunBaseReport.Run method calls the ReportRun.run method with the parm onlyReport = true.
            return;
        }
    }

    this.buildPrintGrandTotal();
    this.buildPrintOnlyTotals();

    // VAR Changed on 06 Feb 2012 at 14:14:30 by JXie7519 Begin
    if(this.printJobSettings().clientPrintJobSettings())
    {
        this.printJobSettings().clientPrintJobSettings().suppressScalingMessage(true);
        this.suppressReportIsEmptyMessage(true);
    }
    else
    {
        this.printJobSettings().suppressScalingMessage(true);
        this.suppressReportIsEmptyMessage(true);
    }
    // VAR Changed on 06 Feb 2012 at 14:14:30 by JXie7519 End

    super();
}

Now we don't have to modify each and every report and our users are happy.

Note that you can still override the settings in your report. In some reports this is done by default, like SalesInvoice and SalesConfirm.

没有评论:

发表评论