I was given a task to perform renaming of Items in the InventTable.
In an environment that is to go live - so THERE WERE NO TRANSACTIONS OG STOCK LEVELS. If this has been the case we would have adviced the customer to live with it, as the renaming process potentially would have taken a very long time
Nearly 75% of the item numbers were named with 4 digits, the rest with 5.
The customer wanted only 5-digit item numbers.
How to do this in one go ?
A simple job is enough:
static void Job7(Args _args)
{
InventTable inventTable;
;
ttsbegin;
while select forupdate inventTable
where inventTable.ItemId LIKE "????"
{
inventTable.ItemId = "0"+InventTable.ItemId;
inventTable.renamePrimaryKey();
}
ttscommit;
}
or
In an environment that is to go live - so THERE WERE NO TRANSACTIONS OG STOCK LEVELS. If this has been the case we would have adviced the customer to live with it, as the renaming process potentially would have taken a very long time
Nearly 75% of the item numbers were named with 4 digits, the rest with 5.
The customer wanted only 5-digit item numbers.
How to do this in one go ?
A simple job is enough:
static void Job7(Args _args)
{
InventTable inventTable;
;
ttsbegin;
while select forupdate inventTable
where inventTable.ItemId LIKE "????"
{
inventTable.ItemId = "0"+InventTable.ItemId;
inventTable.renamePrimaryKey();
}
ttscommit;
}
or
Static void main updateIds(Args
args)
{
EmplTable
empltable;
Ttsbegin;
Select firstOnly forUpdate
EmplTable
where EmplTable.EmplId == ‘10001’;
If(emplTable.recId != 0)
{
emplTable.EmplId = ‘10101’(New
EmplId);
EmplTable.renamePrimaryKey();
EmplTable.update()
}
Else
Info(‘employee not found’);
ttsCommit;
}
No comments:
Post a Comment