最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Microsoft Dynamics AX 获取表记录条数和存储空间

AX 2009 William 1520浏览 0评论

获取Table 记录数和存储空间的一种方法如下:

static void RecordCount(Args _args)

{
     SysDictTable dictTable;
     ;

     dictTable = new SysDictTable(tablenum(CustTable));
     info(strfmt('Table %1 has %2 records',dictTable.name(),int2str(dictTable.recordCount())));
}

static void RecordSize(Args _args)

{
    SysDictTable dictTable;
    ;

    dictTable = new SysDictTable(tablenum(CustTable));
    info(strfmt('One record of table %1 has this size: %2',dictTable.name(),num2str(dictTable.recordSize(),0,0,1,0)));

}

获取Table 记录数的另一种方法如下:

static void RecordCount2(Args _args)
{
     CustTable      m_CustTable;
     ;

     select count(RecId) from m_CustTable
        where m_CustTable.AccountNum like "3*";

     info(strfmt('Table CustTable has %1 records',int2str(m_CustTable.RecId)));
}

获取Query返回的记录条数的方法如下:

static void Query_cntRecords(Args _args)
{
    Query                query = new Query();
    QueryRun             queryRun;
    QueryBuildDataSource qbd;
    ;

    qbd = query.addDataSource(tablenum(CustTable));
    queryRun = new QueryRun(query);
    info(strfmt("Total Records in Query %1",SysQuery::countTotal(queryRun)));

}

转载请注明:ww12345678 的部落格 | AX Helper » Microsoft Dynamics AX 获取表记录条数和存储空间

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址