如何更改操作保存以仅能够保存新记录
how to change the actionsave to just be able to save the new record
我有输入屏幕来管理确认数据,当更改数据时,数据将保存为 新记录。
有没有其他解决办法,抱歉我的英文不好,谢谢。
我在重新阅读你的问题后更新了我的答案。
我会覆盖坚持。复制要复制的当前记录,从缓存中删除更新的记录,然后插入新行(根据需要更改键)。参见示例...
public override void Persist()
{
//Get your current row to copy from
MyDAC rowCopy = PXCache<MyDAC>.CreateCopy(myGraph.MyView.Current)
//If not saving the updated row you need to remove it from the cache
MyView.Cache.Remove(MyView.Cache.Current);
// If removing more than one just do a foreach on MyView.Cache.Updated
//Change the key fields as needed...
rowCopy.SomeKey = someNewValue;
//Change any other fields as needed...
//Insert into the cache your new row
rowCopy = myGraph.MyView.Insert(rowCopy);
base.Persist();
//Set copy row as current
myGraph.MyView.Current = rowCopy;
}
我有输入屏幕来管理确认数据,当更改数据时,数据将保存为 新记录。 有没有其他解决办法,抱歉我的英文不好,谢谢。
我在重新阅读你的问题后更新了我的答案。 我会覆盖坚持。复制要复制的当前记录,从缓存中删除更新的记录,然后插入新行(根据需要更改键)。参见示例...
public override void Persist()
{
//Get your current row to copy from
MyDAC rowCopy = PXCache<MyDAC>.CreateCopy(myGraph.MyView.Current)
//If not saving the updated row you need to remove it from the cache
MyView.Cache.Remove(MyView.Cache.Current);
// If removing more than one just do a foreach on MyView.Cache.Updated
//Change the key fields as needed...
rowCopy.SomeKey = someNewValue;
//Change any other fields as needed...
//Insert into the cache your new row
rowCopy = myGraph.MyView.Insert(rowCopy);
base.Persist();
//Set copy row as current
myGraph.MyView.Current = rowCopy;
}