在 Genexus 中将 SDT 数据转换为 BC

Convert SDT data to BC in Genexus

我用 Genexus 15 中的数据填充了 SDT,需要将其保存在交易中。 SDT 具有两级结构,包含 header 个信息和详细信息项。

我尝试使用此 DataProvider,但出了点问题,因为在尝试执行它时出现外键违规错误:

规则:

parm(in: &NewInvoice); // SDT variable

来源:

DPInvoice 
{
    StampId = &NewInvoice.StampId
    InvoiceNumber = &NewInvoice.InvoiceNumber
    CustomerId = &NewInvoice.CustomerId
    Concept
    {
        ProductId = &NewInvoice.Concept.CurrentItem.ProductId
        ConceptQty = &NewInvoice.Concept.CurrentItem.ConceptQty
    }
}

web面板中触发DP的事件:

&Invoice = DPInvoice(&NewInvoice)
&Invoice.Insert()
commit

This is the transaction structure

This is the SDT Structure

请帮帮我!

您必须迭代 &NewInvoice 的第二级。

在 DataProvider 中定义类型为 SDTInvoiceCopy1.ConceptItem 的变量 &NewInvoiceItem 并使用以下源代码:

DPInvoice 
{
    StampId = &NewInvoice.StampId
    InvoiceNumber = &NewInvoice.InvoiceNumber
    CustomerId = &NewInvoice.CustomerId
    Concept Input &NewInvoiceItem in &NewInvoice.Concept
    {
        ProductId = &NewInvoiceItem.ProductId
        ConceptQty = &NewInvoiceItem.ConceptQty
    }
}