Friday, May 3, 2019

How to see SubledgerJournalEntry records not committed yet by ttsCommit()

Sometimes we want to see records before they are inserted into data base. We can do it on the SQL side by means of with (NOLOCK) option.

Let's say we are debugging creation of SubledgerJournalEntry records. Place the following code in a new query in SQL Management Studio.


USE [AxDB]
GO

SELECT journal.ACCOUNTINGCURRENCYAMOUNT, journal.POSTINGTYPE, enum.NAME as PostingTypeName
 FROM SUBLEDGERJOURNALACCOUNTENTRY as journal with (NOLOCK)
 JOIN ENUMVALUETABLE as enum
  ON journal.POSTINGTYPE = enum.ENUMVALUE
  JOIN SubledgerJournalEntry as sub with (NOLOCK)
  ON journal.SUBLEDGERJOURNALENTRY = sub.RecId
  where sub.ACCOUNTINGEVENT = 5637159590
  AND enum.ENUMID = 1811

SELECT SubledgerJournalEntry, SUM(TransactionCurrencyAmount) as sumTrans, SUM(AccountingCurrencyAmount) as sumAcc, SUM(ReportingCurrencyAmount) as sumRep FROM 
SubledgerJournalAccountEntry with (NOLOCK)

inner join SubledgerJournalEntry with (NOLOCK)
on SubledgerJournalAccountEntry.SubledgerJournalEntry = SubledgerJournalEntry.RecId
and SubledgerJournalEntry.ACCOUNTINGEVENT = 5637159590
GROUP BY SubledgerJournalAccountEntry.SubledgerJournalEntry

So, now we can see it before they are committed by ttsCommit().


No comments: