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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how "Common Table" is working practically

(0) ShareShare
ReportReport
Posted on by 30

Hi All,

Can you please let me know how "Common Table" been used ?  Means how it's working practically.

Kindly give me an example.

Thanks!

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    236,505 Most Valuable Professional on at
    RE: how "Common Table" is working practically

    You can find some information and examples by putting ax common table to a search engine. You can also use cross-references to find examples in AX.

  • Verified answer
    Crispin John Augustine Profile Picture
    37,081 on at
    RE: how "Common Table" is working practically

    A very common use is in a Code that performs the same function for multiple tables. I'll explain this below, but look for more examples as Martin recommends..

    Imagine a method that performs a certain function, and

    void testCommon(Common _common)

    {

       Switch (_common.tableId)

       {

           case tableNum(CustTable):

           // logic for custtable.

           break;

           case tableNum(VendTable):

           // logic for Vendtable.

           break;

       }

    }

    You can thus call the same method with different tables as Parameter, and perform corresponding functions. Is that clear?

  • @rp@n Profile Picture
    30 on at
    RE: how "Common Table" is working practically

    Thanks Crispin,

    Suppose if I worked with VendTable then Common table hold the table id of Vend table and passed as a parameter.

    basically it's (Common table) hold the table ids of all table in AX. correct ?

    Thanks!

  • Verified answer
    Crispin John Augustine Profile Picture
    37,081 on at
    RE: how "Common Table" is working practically

    Probably your question has to be rephrased, but I'm sure this will help better.

    Consider Common as a parent of all tables. So you can assign all childs(tables) to the parent (Common), and otherway(with condition)

    eg: common = custTable; will work without a condition

    if (common.tableId ==  tableNum(CustTable))

    custTable = common;

  • @rp@n Profile Picture
    30 on at
    RE: how "Common Table" is working practically

    Thanks Crispin,

    Now I understand. One things only.

    Is there any specific criteria to use "Common Table" ? OR I can use anytime.

    Please give me more shed on this.

    Thanks!

  • Verified answer
    Crispin John Augustine Profile Picture
    37,081 on at
    RE: how "Common Table" is working practically

    There is no defined "criteria" to use it. It solely depends on your design.

    If you think, a same Code block can be used for multiple tables, you can use it.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans