Skip to main content

Posts

Showing posts with the label forupdate

How to Update Project Status by Code in Ax 2012

To Update Project Status by Code in Ax 2012 You can get help from below code sample. In this code if Project status is created then it will update to In process stage. Same way you can try as per your requirement. Projtable projTable; int cnt; ttsBegin; while select forUpdate projtable where projTable.Status==ProjStatus::Created { cnt++; projtable.Status=ProjStatus::InProcess; projtable.update(); } ttsCommit; info(strFmt("%1 Project Updated",cnt));

Remove spaces from Text in Ax 2012

To Remove spaces from Text you can get idea from below code sample. Here we are update name fields which include spaces on right and left side . Dirpartytable Dirpartytable; Name Name; ; while select forUpdate Dirpartytable { ttsBegin; Name= strRTrim(strLTrim(Dirpartytable.Name)); Dirpartytable.Name = Name; Dirpartytable.doUpdate(); ttsCommit; } info("Done");

Update and Update_RecordSet Code sample in Ax 2012

This is Update and Update_RecordSet Code sample. Result of both will be same . TestTable TestTable; //Update_Recordset update_recordset TestTable setting Name ="New Enterprises" where TestTable.Accountnum =="uS-027"; //Update ttsBegin; while select forupdate TestTable where TestTable.Accountnum =="uS-027" { TestTable.Name ="New Enterprises"; TestTable.update(); } ttsCommit; info("OK");