【发布时间】:2015-10-14 01:04:49
【问题描述】:
我正在使用 Data Import Export Framework (DIXF) 解决文件交换(导出)问题,我想将生成方法添加到 Find LineAmount Purchline 与来自 PurchLine 表的接收行 VendPackingSlipTrans 关联。我创建了以下脚本,但我需要帮助:
[DMFTargetTransformationAttribute(true),DMFTargetTransformationDescAttribute("Function that generate LineAmount"),
DMFTargetTransformationSequenceAttribute(11),
DMFTargetTransFieldListAttribute([fieldStr(DMFVendPackingSlipTransEntity,LineAmount)])
]
public container GenerateLineAmount(boolean _stagingToTarget = true)
{
container res;
PurchLine purchLine;
VendPackingSlipTrans vendPackingSlipTrans;
if (_stagingToTarget)
{
select firstOnly purchLine
where purchLine.LineAmount == entity.LineAmount &&
vendPackingSlipTrans.OrigPurchid == purchLine.PurchId &&
vendPackingSlipTrans.PurchaseLineLineNumber == purchLine.LineNumber;
if ( ! purchLine )
{
entity.LineAmount = purchLine.LineAmount ;
entity.insert();
}
}
res = [entity.LineAmount];
return res;
}
我必须使用 DMF 将数据从 ax 导出到文件,因此我在 VendPackingSlipTrans 中存在一些字段,因此在暂存表中添加了此字段,但其他字段存在于其他表中,例如 LineAmount。我不知道如何添加临时表中的其他字段。为此,我在 myEnityclass 中创建了生成方法来关联源表中的字段。到临时表
【问题讨论】:
-
您需要什么帮助?
-
“如何将供应商产品收货行 (VendPackingSlipTrans) 与采购行 (PurchLine) 关联起来?”... 是这个问题吗?
-
select 语句和以下设置字段
LineAmount的逻辑没有任何意义。正如当前编写的那样,LineAmount将始终为零,因为 select 语句将检索PurchLine记录,其中PurchId为空,LineNumber为零(因为vendPackingSlipTrans变量永远不会被实例化),除非您有损坏的数据,这样的PurchLine记录不应该存在。在这种方法中调用entity.insert()也是没有意义的。Generate方法用于设置实体记录的一个字段,而不是插入实体记录。 -
@ian_scho 是并获得
LineAmount的值,因为我希望在临时表中使用此值 -
@FH-Inway 你能帮忙纠正这个选择语句吗
标签: axapta dynamics-ax-2012 x++ dynamics-ax-2012-r3