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)

.net interop joining AOT tables in visual studio.

(0) ShareShare
ReportReport
Posted on by 865

Hi all,

 

I am trying to create a utility in visual studio using .net interop to x++ and proxy classes, I've added necessary tables in my project, I can access tables individually and can loop them through .next() method, but I want to join these tables so I can get my desired results (I want to display a grid with itemid, name alias, color, size information).

I am unable to figure out how to join inventTable, inventDim, and inventdimcombination for this purpose. Can you guys please tell me how can I join AOT tables without having to use traditional .net business connector methods in visual studio ?

 

Thank you very much.

*This post is locked for comments

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

    I would simply use the query framework. Check this example:

    int salesTableId = new SalesTable().TableId;
    int salesLineId = new SalesLine().TableId;

    Query query = new Query();
    QueryBuildDataSource salesTableDs = query.addDataSource(salesTableId);
    QueryBuildDataSource salesLineDs = salesTableDs.addDataSource(salesLineId);
    salesLineDs.relations = true;

    QueryRun qr = new QueryRun((object)query);
    while (qr.next())
    {
        SalesTable st = new SalesTable(qr.get(salesTableId));
        SalesLine sl = new SalesLine(qr.get(salesLineId));
    }
  • alphaprolix Profile Picture
    865 on at

    Thanks for your reply Martin,

    when I try to run this code, VS tells me that No constructor of QueryRun object takes 1 argument, compiler seems to happy when I do not pass any argument. please tell me what I am doing wrong. is there a way I can design a query in Morph X and then call it from .net

    I tried to add a method in my class in morph x which returns an instance of invent table, but cannot figure out how to populate invent table buffer in vs from that from my class, it gives me errors like

    "cannot fetch the value of field because information about the containing class is unavailable"

    and while.next()  is not working on table buffer in VS.

    I wanted to design my utility with proxy classes functionality as it provides intellisense but facing some fundamental level issues. please suggest what should I do.

     


     

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    I don't think you can create a proxy class with a parameterless constructor - there is always a constructor accepting Microsoft.Dynamics.AX.ManagedInterop.Object. Hiow did you create the QueryRun class?

    If you failed to construct QueryRun, you obviously can't get any data, no need to waste time with trying.

    About "while.next()  is not working on table buffer in VS", I don't have any such code in my solution - it's QueryRun.next() method.

    You can design the query in AX as usual - as an AOT query or in X++ code.

     

  • alphaprolix Profile Picture
    865 on at

    Thanks for replying

    I did not create the queryRun class, it is available automatically in my project, I followed this walkthrough to setup the connection with AX. sorry about while.next() I intended to say while (table.next()).

    Anyway, I think I am not ready to use this new functionality as there is not much documentation available on this topic, I will start creating utility with .net Business Connector.

     

     

  • asif.sanaullah Profile Picture
    470 on at

    Dear alphaprolix,

    .NET Business connector is not recommended in AX 2012 < on wards.

    Please use following posts to understand and learn proxy classes.

    1. www.amer-ax.com/.../net-business-connector

    2. learnax.blogspot.com/.../net-proxies-alternative-to-net-business.html

    3.daxmusings.codecrib.com/.../ax-2012-net-coding-business-logic-in-c.html

    Regards and Thanks

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