web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2009: Saving Report directly file using FileSave Dialog???

(0) ShareShare
ReportReport
Posted on by 1,085

Hello All,

Have anyone of you ever tried saving a report directly into file in certain format?

I have a MorphX Report which is designed like a simple report list. Data is in fixed
positions and listed row after row.

I would like to print that report directly into file using
FileSave-dialog.

That dialog asks filename and it’s extension. I have added csv and xsl filetypes. BUT if I
choose .csv or .xsl it doesn’t convert them into those formats.

I read from Forums that AX in this case should internally convert report into as csv file, but
it doesn’t seems to do it so.


I have used Article: Exporting data to Excel as starting point and made some corrections to
bugs but still something is missing. Any ideas?


Code in the Report is like below and methods executed from top to down.

/// Initialization
public void init()
{
#Excel
printHeading = true;
this.printJobSettings().setTarget(PrintMedium::File);
this.printJobSettings().preferredFileFormat(PrintFormat::ASCII);
this.printJobSettings().fileName(fileName);

super();
}

/// Dialog whick asks file name to be saved and it's format
public Object dialog(Object _dialog)
{
#Excel
Dialog dialog = super(_dialog);
dlgFileName = dialog.addFieldValue(typeid(FileNameSave), "");
dialog.filenameLookupFilter(["@SYS28576",#XLS,"@SYS100852","*.csv"]);
dialog.filenameLookupTitle("Select filename and type");
dlgFileName.value(filename);
return dialog;
}

/// Processing
public void run()
{;
this.printJobSettings().fileName(fileName);
#Excel
this.printJobSettings().format(PrintFormat::ASCII);
super();
}


public boolean printerSettings(int _showWhat=-1)
{
boolean ret;

ret = super(_showWhat);

return ret;
}

Br

Michael

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Where did you read that ASCII format is automatically converted to CSV or XLS according to mere file name? I really don't think that such a feature exist.

    PrintFormat enum is what defines supported formats - and there is no CSV or Excel.

  • Michael_Land Profile Picture
    1,085 on at

    Don't remember exact URL anymore but what comes to the different article shekhardiptiman.wordpress.com/.../dynamics-ax-2009-exporting-data-to-excel-part2

    It says:  I assume that we all understand that any standard AX report can be sent to a variety of Output devices such as Printer,Screen,Fax,File ( CSV,TXT,PDF,EXCEL etc) .

    So, what is the way to choose and get CSV or .XSL files?

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    That will always generate ASCII text files - you can end the file name with .csv, .xls, .docx or anything and the content will be still the same. The method described in the link simply relies on that Excel to be able to display the text file in a reasonable way.

  • Michael_Land Profile Picture
    1,085 on at

    Okey, thanks!

    Do you know any way how to get to that point where OK button is pressed and there in own Custom Class do the dataconversion?

    What I'm asking are there any ways to customize save method so that it really saves csv or xsl file?

    Br

    Michael

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans