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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how to reference the same field in a self join from a AOT query in a data provider

(0) ShareShare
ReportReport
Posted on by 72

Hello,

Quick question:

How do I reference a field in a self join? I have a AOT query which I am building a data provider for. 

The query is as follows:

pastedimage1568299773043v1.png

Now I have a self join on Ecorescategory to get the category and parent category which is in the field 'Name'.

My DP uses RecordInsertList however in the query run I do not know how to reference it and the name I have given it in the query does not work for the table.

        ItemVariantView  ItemVariantView = _queryRun.get(tableNum(ItemVariantView));
        ProductPricingReportTempTable.ItemId = ItemVariantView.ItemId;
        ProductPricingReportTempTable.VariantId = ItemVariantView.VariantId;

        PriceDiscTable  priceDiscTable = _queryRun.get(tableNum(PriceDiscTable));
        ProductPricingReportTempTable.AccountRelation  = priceDiscTable.AccountRelation;
        ProductPricingReportTempTable.Amount = priceDiscTable.Amount;
        ProductPricingReportTempTable.Currency = priceDiscTable.Currency;
        ProductPricingReportTempTable.FromDate = priceDiscTable.FromDate;
        ProductPricingReportTempTable.ReasonCode = priceDiscTable.ReasonCode;
        ProductPricingReportTempTable.ToDate = priceDiscTable.ToDate;


        EcoResCategory ecoResCategory = _queryRun.get(tableNum(EcoResCategory));
        ProductPricingReportTempTable.Category = ecoResCategory.Name;

Hope that makes sense?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi!

    You can try to use _queryRun.getNo() instead of get().

    docs.microsoft.com/.../how-to-create-queries-by-using-x

  • Verified answer
    Martin Dráb Profile Picture
    240,540 Most Valuable Professional on at

    Another option is utilizing the second parameter of get: _queryRun.get(tableNum(EcoResCategory), 2).

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans