2016-10-26 13 views
1

を登録しよう(デフォルトAX2012クラスとコードを、何の変更がそれになされていない)で登録しようEXISTS:メソッドでCustVendTransDetailscalcCashDiscountsは、私はAX2012クラスに問題が午前

次のクエリは私にエラーを与えているThe select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.

if (TaxParameters::canApplyCashDiscOnInvoice_ES()) 
{ 
    insert_recordset tmpValue 
     (CustVendTransRefRecId, AmountMST) 
     select CustVendTransRefRecId 
     from _custVendAccountStatementIntTmpProcessing 

     exists join custVendTransLoc 
     where 
      custVendTransLoc.RecId == _custVendAccountStatementIntTmpProcessing.CustVendTransRefRecId 

     exists join firstOnly subledgerVoucherGeneralJournalEntry 
     where 
      subledgerVoucherGeneralJournalEntry.Voucher == custVendTransLoc.Voucher && 
      subledgerVoucherGeneralJournalEntry.AccountingDate == custVendTransLoc.TransDate 

     exists join generalJournalEntry 
     where 
      generalJournalEntry.RecId == subledgerVoucherGeneralJournalEntry.GeneralJournalEntry && 
      generalJournalEntry.Ledger == Ledger::current() 

     join AccountingCurrencyAmount from generalJournalAccountEntry 
     where 
      generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId && 
      (generalJournalAccountEntry.PostingType == LedgerPostingType::CustCashDisc || 
      generalJournalAccountEntry.PostingType == LedgerPostingType::VendCashDisc); 

    update_recordSet _custVendAccountStatementIntTmpProcessing setting 
     UtilizedCashDisc = tmpValue.AmountMST, 
     PossibleCashDisc = tmpValue.AmountMST 
     join tmpValue 
     where 
      tmpValue.CustVendTransRefRecId == _custVendAccountStatementIntTmpProcessing.CustVendTransRefRecId; 
} 

私はこの理由を理解していますが、この問題の解決方法はわかりません。 exist joinを通常のjoinに置き換えるのは問題になりますか?

exist joinjoinに置き換えても問題は解決しますが、データにどのような違いがあるのでしょうか。 1つのフィールドしか選択していないので、

答えて

2

が加入:

insert_recordset tmpValue (CustVendTransRefRecId, AmountMST) 
    select CustVendTransRefRecId 
    from _custVendAccountStatementIntTmpProcessing 

    join AccountingCurrencyAmount from generalJournalAccountEntry // Moved up 
    where generalJournalAccountEntry.PostingType == LedgerPostingType::CustCashDisc || 
      generalJournalAccountEntry.PostingType == LedgerPostingType::VendCashDisc 

    exists join custVendTransLoc 
    where 
     custVendTransLoc.RecId == _custVendAccountStatementIntTmpProcessing.CustVendTransRefRecId 

    exists join firstOnly subledgerVoucherGeneralJournalEntry 
    where 
     subledgerVoucherGeneralJournalEntry.Voucher == custVendTransLoc.Voucher && 
     subledgerVoucherGeneralJournalEntry.AccountingDate == custVendTransLoc.TransDate 

    exists join generalJournalEntry 
    where 
     generalJournalEntry.RecId == subledgerVoucherGeneralJournalEntry.GeneralJournalEntry && && 
     generalJournalEntry.RecId == generalJournalAccountEntry.GeneralJournalEntry && // Moved from join 
     generalJournalEntry.Ledger == Ledger::current(); 
+0

ありがとうございました、これは私の問題を解決しました。 –

1

既存の結合を結合に置き換えても、問題は解決されません。 Existは、フィールドを返さずに本質的にテーブルへの内部結合に参加する方法です。

クエリは、正確に挿入が期待しているものであるgeneralJournalAccountEntryから_custVendAccountStatementIntTmpProcessingおよびAccountingCurrencyAmountからCustVendTransRefRecIdを返す必要があります。

私は、クエリが実際に何も返さないと予想しています。使用している基準を確認し、データを確認してください。あなたがの順序を切り替えることを試みることができ

関連する問題