目前,我正在使用Conversion Studio引入一个CSV文件并将内容存储在一个AX表中。这部分起作用了。我定义了一个块,并且字段被正确映射。
CSV文件包含几个注释列,如Comments-1、Comments-2等。这些列的数量是固定的。公共评论被标记为Comments-1...5,而私有评论被标记为Private-Comment-1...5。
所需的结果是将数据带入AX表(就像当前正在运行的那样),并将注释字段连接起来,或者将它们作为单独的注释存储到DocuRef表中作为内部或外部注释。
它不需要在我已经设置好的Conversion Studio项目中设置一个新的块吗?你能给我指出一个可能展示类似过程的资源或如何做到这一点吗?
提前感谢!
发布于 2011-04-27 01:29:32
在追逐兔子到最深的兔子洞后,我发现最简单的方法如下所示:
覆盖文档处理程序(扩展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;
}https://stackoverflow.com/questions/5540779
复制相似问题