static void Jimmy_RenameKeyLookupValues(Args _args)
{
InventTable IT,ITupdate;
Dialog dlg = new Dialog("updated to comoany Items infomation");
DialogField dlgItem = dlg.addField(types::String,'after rename Items:',"Format such as :Items + ',' + Items + ',' + items");
SysDataBaseLog SysDataBaseLog;
Container Con;
fieldId fieldId;
List List,ListKey;
ListEnumerator le,LeKey;
;
dlgItem.displayHeight(20);
dlgItem.displayLength(50);
dlg.doInit();
if(!dlg.run())
return ;
le = global::strSplit(dlgItem.value(),',').getEnumerator();
while (le.moveNext())
{
//ttsbegin;
IT = InventTable::find(le.current(),true);
if(IT)
{
select firstonly SysDataBaseLog
where SysDataBaseLog.table == tablenum(InventTable)
&& SysDataBaseLog.LogType == DatabaseLogType::RenameKey
&& SysDataBaseLog.Description like IT.ItemId + '*';
if(SysDataBaseLog)
{
ListKey = SysDataBaseLog.getDataAslist();
LeKey = ListKey.getEnumerator();
while (LeKey.moveNext())
{
Con = LeKey.current();
fieldId = conpeek(Con, 1);
info(strfmt("%1,%2,%3",fieldId,conpeek(Con, 2),conpeek(Con, 3)));
IT.OrgItemId = sysdatabaselog.contents2Str(conpeek(Con, 3), fieldId);
info(strfmt("%1 - %2",IT.ItemId,IT.OrgItemId));
break;
}
}
if(!IT.OrgItemId)
IT.OrgItemId = IT.ItemId;
//ITUpdateOrg.doUpdate();
}
// ttscommit;
}
}