如何插入自定义 table

How to insert into custom table

我对发票和备忘录屏幕进行了自定义,我有一个完全自定义的 table,我想在其中写入错误日志条目。由于这与培训解决问题的方式并不相符——有没有办法直接做到这一点?我注意到有一个 PXInsert<> 命令 - 但我找不到任何文档,无论是在框架帮助中还是在 Stack Overflow 上。

我知道我可以为我的自定义 table 的 DAC 创建缓存对象并使用该缓存的插入命令 - 但我不知道这样做的确切语法(我不能'找不到适合我在培训手册中尝试做的事情)。也许我错过了。

创建 Cache 对象(或者我想您可能会想到图形)的语法是使用 PXGraph 对象。这是一个例子:

private void Function()
{
  //TargetGraph is the name of the custom page
  TargetGraph graph = PXGraph.CreateInstance<TargetGraph>();
  //TargetDAC is the name of the custom DAC in your customizations
  TargetDAC dac = new TargetDAC();
  //Set all data to dac
  dac.Log = log;
  //Finally insert and perform the save action for the graph
  graph.LogView.Insert(dac);
  graph.Actions.PressSave();
}

如果这也是您所需要的,也许有人可以在这个答案中添加有关如何从页面中获取错误的信息。