Hi guys, I got a requirement like I need to add new field in standard table and I need to set that field as Index field. I have already some custom data in my machine. I get few errors while I set sync. So I need to fill some dummy data in that field, so I have done that by using below code.
static void getNumberSeq(Args _args) { Mytable mytable; Name id, myId = 'Test00'; //CustGroup custGroup; int myIdNum; void getId(int _id) { str addZero = '00000'; for (int i = 1; i<=5 ; i++) { if (strLen(int2Str(_id)) == i) { addZero = subStr(addZero, 0, (strLen(addZero) - i)); break; } } id = addZero + int2Str(_id); } ttsbegin; while select forupdate crosscompany mytable where !mytable.field1 { myIdNum++; getid(myIdNum); changecompany(mytable.dataareaid) { mytable.field1 = myId + id; mytable.doupdate(); } } ttscommit; /*while select forupdate crossCompany custGroup { org++; getId(org); changeCompany(custGroup.dataAreaId) { info(strFmt('cutGroup- %1, Id -%2',custGroup.CustGroup,myId + id)); } }*/ }
Please check. For your reference I have used custGroup table and that output I have shown in info. This example I have done in 2012 and D365FO. Only 2012 Output I am giving.
Keep daxing!!
No comments:
Post a Comment