2017-04-12 5 views
-1

私はX ++開発が初めてです。ベンダーのエージングレポートにフィールドを追加しようとしています。それは例外として行われました。実行時に一時テーブルのデータを更新する方法AX 2012

私の問題は、実行時にフィールドの値を更新しています。

シナリオ "AA_BBBBBB"を含む請求書フィールドがあります。私がする必要があるのは、AA、BBBBBB、およびBBBBBBを請求書フィールドに、AAを新しいフィールド(請求書タイプ)に更新する必要があるということです。私はこの方法VendAgingReportDP \ insertVendAgingReportTmpでVendAgingReportTmpをTEMPTABLEする値を得た後、私は上記のシナリオが、code is not selecting the records from VendAgingReportTmpを更新しようとしたんだ

、。誰かが私にこのことをやってもらう手助けができますか? VendAgingReportDPクラスinsertVendAgingReportTmp

+1

は、あなたはそれが働いていない作業中のコードを投稿することができますか? –

+0

[mcve]の作成方法も見てください。 –

答えて

0

を、私は、以下の追加により、溶液、

  • 追加InvoiceTypeはフィールドを得ました誘惑するにはVendTmpAccountSumこれはグローバル変数として宣言されているためです。
  • カスタムインボイスタイプをインボイスタイプフィールドにVendTmpAccountSumに更新しました。
  • そして性能を高めるためにinsert_recordsetを用いてVendTmpAccountSumテーブルからVendAgingReportTmpに全データを挿入します。

おかげで、

1

アップデートを実行する必要はありませんvendAgingReportTmp.insert();前に、あなたのコードがある場合は、標準のコードの最後の行はvendAgingReportTmp.insert();

です。 vendAgingReportTmp.update();vendAgingReportTmp.insert();の前に入力すると、そのエラーが発生します。

vendAgingReportTmp.update(); withhout //YourCode//YourCode END内にコードを入れてください:

/// <summary> 
/// Inserts records into the temporary <c>VendAgingReportTmp</c> table. 
/// </summary> 
/// <param name="_reverseAmountsAndHeadings"> 
/// A boolean value which indicates whether the column values should be  reversed. 
/// </param> 
private void insertVendAgingReportTmp(boolean _reverseAmountsAndHeadings) 
{ 
    vendAgingReportTmp.AsOfDate = strFmt("@SYS84682",  date2StrUsr(contract.parmZeroDate(), DateFlags::FormatAll),  contract.parmDateTransactionDuedate()); 
    vendAgingReportTmp.HeadingAccount = strFmt("@SYS24500"); 
    vendAgingReportTmp.HeadingName = strFmt("@SYS7399"); 

    switch (contract.parmDateTransactionDuedate()) 
    { 
     case DateTransactionDuedate::DocumentDate : vendAgingReportTmp.HeadingDate = "@SYS2587"; 
               break; 
     case DateTransactionDuedate::TransactionDate : vendAgingReportTmp.HeadingDate = "@SYS67"; 
               break; 
     case DateTransactionDuedate::DueDate : vendAgingReportTmp.HeadingDate =  "@SYS14588"; 
                break; 
     default : vendAgingReportTmp.HeadingDate = "@SYS14588"; 
                break; 
    } 

    if (_reverseAmountsAndHeadings) 
    { 
     this.setVendAgingReportTmpInReverse(); 
    } 
    else 
    { 
     this.setVendAgingReportTmp(); 
    } 

    vendAgingReportTmp.TransDate = tmpAccountSum.TransDate; 
    vendAgingReportTmp.InvoiceId = tmpAccountSum.InvoiceId; 
    vendAgingReportTmp.Voucher = tmpAccountSum.Voucher; 
    vendAgingReportTmp.AccountNum = tmpAccountSum.AccountNum; 
    vendAgingReportTmp.Name = vendTable.name(); 
    vendAgingReportTmp.VendAccount = tmpAccountSum.AccountNum; 
    vendAgingReportTmp.Txt = tmpAccountSum.Txt; 
    vendAgingReportTmp.Balance = 100; 
    vendAgingReportTmp.CurrencyCode = tmpAccountSum.CurrencyCode; 
    vendAgingReportTmp.VendGroup = vendTable.VendGroup; 

    //YourCode 
    //... 
    //... 
    //... 
    //YourCode END 

    vendAgingReportTmp.insert(); 
} 
+0

実際には私はinsert_recordsetを使用しています –

+1

@SankarR:あなたの答えにあなたのチャンスを増やすためにあなたの質問にこの情報をお寄せください。 –

+0

@SankarRあなたのコードを追加して、あなたに正しい答えを与えてください。 –

関連する問題