How to find a table name by ID in Dynamics AX
Asked Answered
M

8

16

Each table in the AOT has an ID, how can I discover the table name given an ID?

Migraine answered 8/1, 2010 at 0:41 Comment(0)
H
30

Looking at the SQL dictironary is really the correct method. Search for the line with the FieldId equal to 0. Using TSQL this will tell the name of the table for tableid 505

select NAME 
  from SQLDICTIONARY
 where TABLEID = 505
   and FIELDID = 0
Hydroxyl answered 11/10, 2012 at 12:16 Comment(1)
you are a legend. Was searching all over - even model db.Niobous
T
19

From X++, use the tableId2Name function.

From the GUI, choose Tools/Development tools/Application objects/Application objects and filter for a recordType of TableInternalHeader and a parentId of the table id you are looking for.

Or in the AOT, right click on Tables and choose Find. On the Name & Location tab, set Search to All nodes. On the Properties tab click Selected next to ID and fill in the table id in the Range field.

Toad answered 8/1, 2010 at 4:5 Comment(0)
U
3

I dont'know if this is your answer, if you want to give the TableName with his ID, you can use the method: str tableId2Name(int _tableid)

For example: If YourTable has ID :123456 ; use method

       tableId2PName(123456) 

will return the str name YourTable.

info(strFmt("%1" , tableId2PName(123456))); -> VideoStamp the name.

I used the info in https://msdn.microsoft.com/en-us/library/aa498759.aspx

I hope to useful , greetings!

Unappealable answered 13/4, 2015 at 13:28 Comment(0)
A
2

If you need AX system table name you can use tableId2name or DictTable.name method.

If you need SQL table name you shoud use DictTable.name method with first argument of DbBackend::Sql

Example:

print new DictTable(tableNum(DirPartyTable)).name(DbBackend::Sql);
print new DictTable(tableNum(OMOperatingUnit)).name(DbBackend::Sql);
pause;

// result:
// DIRPARTYTABLE
// DIRPARTYTABLE
Antiknock answered 28/4, 2014 at 11:1 Comment(0)
B
2

Or you can try:

select  Name, AxId
from MicrosoftDynamicsAX_model.dbo.ModelElement (nolock) 
where ElementType = 44
order by AxId
Br answered 22/2, 2016 at 15:8 Comment(0)
O
1

In the AOT, go to the System Documentation node. In the Tables node, find SqlDictionary and open it with the table browser. Filter the column TabId with your ID.

Osmium answered 12/11, 2010 at 18:36 Comment(1)
This will not give you the Table name. It will only give you a list of fields that exist within that table ID.Matelot
W
1

In the AOT, go to the System Documentation node. In the Tables node, find SqlDictionary and right click and open it with the table browser. Filter the column TabId with your ID and fieldid == 0, his will give you the name of the table.

Weathering answered 28/8, 2012 at 13:18 Comment(0)
C
1

Easiest way:

  1. Create a project (not necessary but easier to delete later)
  2. Add a new view to your project
  3. Add the data source SqlSyncInfo
  4. Drag the fields ID, MessageType, SyncTable, TableName, etc to field
  5. Open the view

It provides all the table names and their respective IDs. Just filter what you want. If you know the table ID, search for that. If you know the table name, search for that.

Conn answered 12/6, 2018 at 20:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.