AX – D365FO – How to count affected/updated rows in a Update_recordset statement in X++ Code

AX – D365FO – How to count affected/updated rows in a Update_recordset statement in X++ Code

The X++ SQL statement update_recordset enables you to update multiple rows in a single trip to the server. This means that certain tasks may have improved performance by using the power of the SQL server.

update_recordset resembles?delete_from in X++ and to UPDATE SET in SQL. It works on the database server-side on an SQL-style record set, instead of retrieving each record separately by fetching, changing, and updating.

Example

MyTable myTableBuffer;

;

update_recordset myTableBuffer

setting

field1 = 1,

field2 = fieldX + fieldY

where field1 == 0;

How to count affected/updated rows in a Update_recordset statement

update_recordset inventTable

setting

XXXCommercialGroupId = comunanzaXXX.SubGroupId

join comXXX

where inventTable.ItemId == comXXX.comunanzaCode

&& comXXX.SubGroupId != '';

info(strFmt("Copy Items from comXXX Subgroup Id to InventTable Commercial group Id: %1 rows affected", int2Str(inventTable.RowCount())));


Happy Learning!!




要查看或添加评论,请登录

Usama Mehmood的更多文章

社区洞察

其他会员也浏览了