In ax 2012 l'informazione è già presente cliccando quì:
static void LILRecordTableCount(Args _args)
{
Common common;
DictTable dt;
DataArea dataArea;
int64 totalCount;
int64 companyCount;
TableName _tableName = "CustTable";
//metodo 1: usare crossCompany, utile per un conteggio secco
dt = new DictTable(tableName2id(_tableName));
common = dt.makeRecord();
select crossCompany count(RecId) from common;
info(strFmt("Totale record su tutte le company: %1",common.recId));
//metodo 2: usare changeCompany, utile per escludere / includere company nel conteggio
if(dt.dataPrCompany())
{
while select dataArea
where dataArea.id != "DAT"
{
common = null;
changeCompany(dataArea.Id)
{
common = dt.makeRecord();
select count(RecId) from common;
companyCount = common.RecId;
totalCount += companyCount;
info(strFmt("Company %1: %2 record", dataArea.Id, companyCount));
}
}
}
else
{
common = dt.makeRecord();
select count(RecId) from common;
companyCount = common.RecId;
totalCount = companyCount;
}
info(strFmt("Totale record sulle company selezionate: %1", totalCount));
}

Nessun commento:
Posta un commento