Mindaugas Deikus
Mindaugas Deikus

Reputation: 3

Select in Data dictionary

i want get all table names where created person is not "-AOS-" (Dynamics AX). In this code i get only who created first line in table:

for (tablecounter=1; tablecounter<=dict.tableCnt(); tablecounter++)
{
    tableId = dict.tableCnt2Id(tablecounter);
    common = new DictTable(tableId).makeRecord();
    select common  where common.createdBy !="";
    if(common)
    {
       info(strFmt('%1---%2',common.createdBy,dict.tableName(common.TableId))); 
    }
 }

Upvotes: 0

Views: 125

Answers (2)

FH-Inway
FH-Inway

Reputation: 5107

You could also use the project filter (probably not as fast as a direct SQL query, but depending on your requirements more actionable). Project filter

Upvotes: 1

Matej
Matej

Reputation: 7627

You can try with scan over SysModelElement and SysModelElementData tables.

SysModelElement me;
SysModelElementData med;    
while select firstOnly10 me
    where me.ElementType == UtilElementType::Table
    exists join med
    where med.ModelElement == me.RecId
       && med.createdBy != '-AOS-'
{
    info(me.Name);
}

Upvotes: 1

Related Questions