在 AX 2012 中,清空表格数据的方法是使用 “Clear” 方法。具体步骤如下:
首先,需要获取表格的引用。
例如:CustTable custTable = CustTable::find('1001');
然后,使用 Clear 方法清空表格数据。
例如:custTable.clear();
最后,使用 “write” 方法将修改保存到数据库。
例如:custTable.write();
完整示例代码如下:
CustTable custTable;
select firstonly custTable where custTable.AccountNum == '1001';
custTable.clear();
custTable.write();
以上代码将清空编号为 1001 的客户帐户的数据。