2011-04-04 54 views
0

目前,我正在使用Conversion Studio将CSV文件导入并将内容存储在AX表中。这部分工作。我有一个块定义和字段正确映射。使用Conversion Studio通过增加将注释导入Microsoft Dynamics AX 2009

CSV文件包含多个注释列,如注释1,注释2等。这些注释列有固定数量。公众意见标记为Comments-1 ... 5,私人意见标记为Private-Comment-1 ... 5。

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

难道不需要在Conversion Studio项目中设置一个新的块,我已经设置好了吗?你能否指点我可能会显示类似程序或如何执行此操作的资源?

在此先感谢!

回答

0

追兔子下来最深的兔子洞后,我发现最简单的方式来做到这一点,像这样:

覆盖你的文件处理器的onEntityCommit方法(即扩展AppDataDocumentHandler),像这样:

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; 
} 
相关问题