获取AX数据字典

AX提供了很多反射类可以获取元数据信息,刚刚一个同事需要一个AX数据字典的列表,顺手写了一个,没啥技术含量,在这里做个备份,以便以后复制粘贴.
static   void  DataDictionary(Args _args)
{
    #AOT
    
#define.FileName(@"d:\DataDictionary.txt")
    TextBuffer  tb 
= new TextBuffer();
    TreeNode    treeNode 
= TreeNode::findNode(#TablesPath);
    DictTable   dictTable;
    DictField   dictField;
    
int         i;
    ;

    treeNode 
= treeNode.AOTfirstChild();

    
while(treeNode)
    
{
        dictTable 
= new DictTable(tableName2Id(treeNode.AOTname()));
        tb.appendText(dictTable.name()
+' '+dictTable.label());
        tb.appendText(
'\n');
        
for(i=1;i<=dictTable.fieldCnt();i++)
        
{
            dictField 
= new DictField(dictTable.id(),dictTable.fieldCnt2Id(i));
            tb.appendText(
'         '+dictField.name()+' ' + dictField.label());
            tb.appendText(
'\n');
        }

        
        print treeNode.AOTname();
        treeNode 
= treeNode.AOTnextSibling();
        
    }

    tb.toFile(#FileName);

}

当然也可以不用TreeNode,而用Dictionary得到表.
static   void  DataDictionary2(Args _args)
{
    #AOT
    
#define.FileName(@"d:\DataDictionary.txt")
    TextBuffer  tb 
= new TextBuffer();
    Dictionary  dictionary 
= new Dictionary();

    DictTable   dictTable;
    DictField   dictField;
    
int         i;
    
int         j;
    ;

    
for( i=1;i<= dictionary.tableCnt();i++)
    
{
        dictTable 
= new DictTable(dictionary.tableCnt2Id(i));
        tb.appendText(dictTable.name()
+' '+dictTable.label());
        tb.appendText(
'\n');
        
for(j=1;j<=dictTable.fieldCnt();j++)
        
{
            dictField 
= new DictField(dictTable.id(),dictTable.fieldCnt2Id(j));
            tb.appendText(
'         '+dictField.name()+' ' + dictField.label());
            tb.appendText(
'\n');
        }


        print dictTable.name();
        
//treeNode = treeNode.AOTnextSibling();

    }

    tb.toFile(#FileName);

}

转载于:https://www.cnblogs.com/Farseer1215/archive/2007/12/03/981148.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值