Tuesday, March 15, 2016

X++ Deal with a table buffer as a variable

Sometimes we got some requests which need to write the same select statement or query for many tables. This below simple code might be useful.


static void Job16(Args _args)
{
    SysDictTable    dictTable;
    Common          common;    
    str             tblName;
    ;
    
    tblName     = 'InventTable';
    dictTable   = SysDictTable::newName(tblName);
    common      = dictTable.makeRecord();

    select count(RecId) from common;
    info(strFmt('All records of %1 are %2',tblName,common.RecId));    
}


Thanks, Martin DrĂ¡b from this post String value as tableName in Select Statement

No comments:

Post a Comment