0

I have few questions regarding development in Visual Studio C# project for AX 2012.

There is a tool that provides Application Explorer from where you can drag any AOT item (Table, Class) in your project.

I dragged CustTable from the Application Explorer into my project and I can see the proxy class generated for it and all the methods that were in the Table are visible but I am interested to fetch all the records like below

select CustTable

So If I create object of the proxy class in Visual Studio how I will get all the records, there is one possibility to write a method in AX and call in the Visual Studio.

Second question is, I have created a class library and added in the C Sharp project of AOT, how I can use in the X++ classes? Is there anyway to call it. Please provide me some links related to it.

sohail.hussain.dyn
  • 1,411
  • 1
  • 16
  • 26
  • This link helped me how to fetch records in Visual Studio http://daxmusings.codecrib.com/2011/05/ax-2012-net-coding-business-logic-in-c.html but still stuck on how to use .Net Class in X++ – sohail.hussain.dyn Dec 29 '13 at 18:24

2 Answers2

1

You can do one of the following : (assuming you have 2012 R2 by now)

  • You can use the new Linq provider: For sample code on how to do this, you can see here : http://msdn.microsoft.com/en-us/library/jj677293.aspx

  • You can use the table proxy as you mention above but this is done by using the find method on the Custtable.

    CustTable custtable = new CustTable(); custtable = CustTable.findByCompany(dataAreaId, accountNum);

  • You could also use the business connector which has been around for a while now. An example of this is found here : http://msdn.microsoft.com/en-us/library/cc197126.aspx (This lets you use things like : axRecord.ExecuteStmt("select * from %1"); )

Kenny Saelen
  • 894
  • 1
  • 5
  • 16
1

You can do something like this:

 CustTable c = new CustTable();
        c.ExecuteStmt("select * from %1");

        while (c.Found)
        {
            MessageBox.Show(c.Name);
            c.Next();
        }
alphaprolix
  • 601
  • 2
  • 10
  • 25