Search code examples
axaptax++aot

Axapta: Find table by name in AOT


I would like to query the AOT to see if a table name exists using X++. Can anyone point me in the right direction or provide some sample code for doing that?

If table exists with the name (str tableName) provided, return true; else, return false.


Solution

  • You can use the tableName2Id function. It will return 0 if the table name isn't valid.

    boolean IsValidTable(str _tableName)
    {
        return tableName2Id(_tableName)==0 ? false : true;
    }