Saturday, 20 March 2010

AX - Using Set-Based Updates in X++

This is a reminder more than anything else. Using set based updates is far more efficient.
while select forupdate custTable 
where custTable.CustGroup == '10'
{ 
    custTable.CustGroup = '20'; 
    custTable.doUpdate(); 
}
Can be rewritten in X++ as:
update_recordset custTable 
setting CustGroup = '20' 
where custTable.CustGroup == '10';

No comments: