0

目前,我正在使用 Conversion Studio 引入 CSV 文件并将内容存储在 AX 表中。这部分正在工作。我定义了一个块,并且正确映射了字段。

CSV 文件包含多个评论列,例如 Comments-1、Comments-2 等。这些列的数量是固定的。公共评论标记为 Comments-1...5,私人评论标记为 Private-Comment-1...5。

期望的结果是将数据带入 AX 表(如当前工作的那样)并连接注释字段或将它们作为单独的注释存储到 DocuRef 表中作为内部或外部注释。

它不需要在我已经设置的 Conversion Studio 项目中设置一个新块吗?您能否指出一个可能显示类似程序或如何执行此操作的资源?

提前致谢!

4

1 回答 1

0

在将兔子追到最深的兔子洞之后,我发现最简单的方法是这样的:

覆盖文档处理程序(扩展 AppDataDocumentHandler)的 onEntityCommit 方法,如下所示:

AppEntityAction onEntityCommit(AppDocumentBlock documentBlock, AppBlock fromBlock, AppEntity toEntity)
{

  AppEntityAction ret;
  int64 recId; // Should point to the record currently being imported into CMCTRS
  ;
  ret = super(documentBlock, fromBlock, toEntity);
  recId = toEntity.getRecord().recId;
  // Do whatever you need to do with the recId now
  return ret;

}

这是我插入注释的方法,以防您也需要:

private static boolean insertNote(RefTableId _tableId, int64 _docuRefId, str _note, str _name, boolean _isPublic)
{
  DocuRef docuRef;
  boolean insertResult = false;
  ;
  if (_docuRefId)
  {
    try
    {
        docuRef.clear();
        ttsbegin;
        docuRef.RefCompanyId = curext();
        docuRef.RefTableId = _tableId;
        docuRef.RefRecId = _docuRefId;
        docuRef.TypeId = 'Note';
        docuRef.Name = _name;
        docuRef.Notes = _note;
        docuRef.Restriction = (_isPublic) ? DocuRestriction::External : DocuRestriction::Internal;
        docuRef.insert();
        ttscommit;

        insertResult = true;
    }
    catch
    {
        ttsabort;
        error("Could not insert " + ((_isPublic) ? "public" : "private") + " comment:\n\n\t\"" + _note + "\"");
    }
  }
  return insertResult;
}
于 2011-04-26T17:29:32.067 回答