My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

16 April 2009

Suppress Overwrite question while running Dynamics AX report with output to a file

by Patrik Luca 3 comments

Tag



Introduction

Suppose you want to run a Dynamics AX report, and save the output to a file, for example a PDF file. This can be done easily by clicking the Options button when running the report. Next you can choose Send to File, and you can specify the File name and File format.

If we do this for example for the Customer turnover report (Accounts receivable>Reports>Statistics>Customer>Customer turnover), then your input should look like below and you’ll receive a nice PDF file.

Problem Description: infolog asking to overwrite the existing file

If you run the report twice with the same File name, you’ll get a infolog mentioning the File <filename> already exists. Overwrite?

This could be a problem if you had chosen to run the report in Batch, for example every night. This Overwrite question will prevent the report of generating the output File, since it will be waiting for a user interaction to confirm the existing file can be overwritten.

Solution: Modify init method and modify RunOn property

To suppress this overwrite question, follow the two steps as below:

  1. Step 1: Add following code to the init method of the report.

    public void init()
    {
    super();
    // suppress overwrite message
    element.printJobSettings().warnIfFileExists(false);

    }


  2. Step 2: Modify the RunOn property of the corresponding Menu Item so its value equals Client. In our example we’ll modify the Menu Output Item CustRevenue as in below screenshot.




Comments 3 comments
koekoeh said...

Hi patrik,
I'm Koekoeh from Indonesia.
I've just made a new account in DotNetKicks.com and want to submit a story. But unfortunately the system force me to answer five words related to .NET
Could you please help me to answer it? I really need your help.

Best regards;
Koekoeh

Patrik Luca said...

If you submit a story, you need to choose one category related to .NET for your story indeed: what is your problem exactly with it?

Java Training said...

nice blog.i like it..

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links