Export to Microsoft Excel On a Dynamics AX Form With Multiple Data Sources【转】

AX 2012 now makes it really easy to output to Excel from a form. Quite simply all you need to do is add a Command button to the form and link it to the command Export to Microsoft Excel. This is great for list pages or any form with a single data source.

However you will find that when several data sources are used on a single form then Ax will output the data from the first data source on the form rather than from the specific data source  that the user is selecting when the Export to Microsoft Excel button is clicked.

Even if you add multiple Export to Microsoft Excel buttons and set the data source individually on the button groups you will still find that the output to Excel is from the first data source of the form.

Now the user can get around this by using CTRL – T from any given grid to export that datasource to Excel but a lot of users may not find it easy to remember which hot key to use.

After a bit of hunting around I have found an easy solution to this issue.

Simply override the Clicked method of the Command button control by calling element.selectControl as shown below: –

void clicked()
{
    element.selectControl(Grid); // The "Grid" argument is the name of the grid
                                 // that you want to export from
 
    super();
}

By keeping track of which grid the user is selecting (override the form datasource Active() methods for example) you can control which grid is exported to Excel.

原文地址:http://www.k3technical.com/export-to-microsoft-excel-on-a-form-with-multiple-data-sources/

时间: 05-02

Export to Microsoft Excel On a Dynamics AX Form With Multiple Data Sources【转】的相关文章

[转]Dynamics AX and Generic collections of .Net

转自:http://blogs.msdn.com/b/emeadaxsupport/archive/2009/04/23/dynamics-ax-and-generic-collections-of-net.aspx EMEADAXSupport 23 Apr 2009 9:54 AM 3 I'm using Dynamics AX 2009 and want to instantiate the .NET class "System.Collections.Generic.List"

[Dynamics AX] Data import/export framework(DIXF, DMF) on AX2012 and above

After install Data import/export framework (DIXF, DMF) on AX 2012 R2 and above, we should make sure two following things ready The "Microsoft Dynamics Ax Data Import Export Framework Service Users" group exist under Local Users and Groups > G

Dynamics AX 2012 R2 无法创建类"Excel.Application"的COM对象

    Reinhard在做一个Excel导入项目时,发现X++代码一旦执行到Excel组件部分,就会报如下错误: 无法创建类"Excel.Application"的COM对象.请确保在计算机""上已正确注册该对象.     根据错误提示,我们先去组件服务中,查找名为Microsoft Excel Application的COM组件.     Reinhard并没有在COM组件列表中,找到该COM组件.我们知道,Microsoft Excel Application

[eBook]Inside Microsoft Dynamics AX 2012 R3发布

最近一本关于Microsoft Dynamics AX 2012开发的书<Inside Microsoft Dynamics AX 2012 R3> 发布. Book Description Fully updated for Microsoft Dynamics AX 2012 R3! Dig into the architecture and internals of Microsoft Dynamics AX 2012 R3 – with firsthand insights from

Understanding the Settlement Mechanism in Microsoft Dynamics AX

see more at http://blog.mohamedaamer.com/microsoft-dynamics/understanding-the-settlement-mechanism-in-microsoft-dynamics-ax/ Settlement is an accounting transaction that occurs on accounts payable, accounts receivables, and general ledger. This trans

Error:Microsoft.Dynamics.Ax.Xpp.InfoException: Exception of type &#39;Microsoft.Dynamics.Ax.Xpp.InfoException

I had the same issue with AX 2012 R2 and SQL Server 2012. When I try to call the "calc" method in SalesQuotationTotals calss by business connectors ,the operation  failed with the following message on the infolog: Microsoft.Dynamics.Ax.Xpp.InfoE

Changes in Microsoft Dynamics AX 2012 InventTrans data model

The purpose of this post is to give an overview about the changes been made in the Dynamics AX 2012 data model related to inventory transactions. Before AX2012, the only table used for recording all the inventory transactions was InventTrans.  In AX2

Microsoft Dynamics AX 2012: How to get Company,Customer and Vendor address in AX 2012

Scenario:  “How to get Addresses of “Customer, Vendor and Company” 1)      First we need to identify which table store address of each entity Table : LogisticsPostalAddress  : In Dynamics AX 2012 this is the main table which stores every address of e

Dynamics AX R2 安装Reporting Services 扩展

    今天Reinhard在VS中部署SSRS报表时,接到以下错误: 部署因错误而被取消.在报表服务器上,验证:-SQL Server Reporting Services 服务是否正在运行.     接着,Reinhard进入到AX中,检查系统的报表服务器配置是否正确.不知道怎么配置的同学可以查看Reinhard之前的博文 Dynamics AX 2012 R2 配置报表服务器  .检查发现,报表服务器中的配置也正确.Reinhard点击了一下 验证设置 按钮,收到以下错误: 无法连接到位于