Notifications
Announcements
No record found.
Hi all
How to differentiate between credit and debit value on the same column through x++ ?
Thanks
*This post is locked for comments
Please, could you detail a little more or question?
Hi,
The picture shared is not visible to me. Can you retry share the picture, or explain your question in more detail?
Credit amount will be negative value and debit value will be have positive value.
When a field in table is exteded to Exteded Data type AmountMSTDebCred it displays value in indented format for quick understanding purpose
but if you assign that value to a ammount type field
its will have vlaue with negative sign if credit amount
Try validating following code
LedgerTrans trans;
Amount CreditDebitAmt;
;
select trans where trans.RecId == 5644448870; <<assign RecId as per your data>
CreditDebitAmt = trans.AmountMST;
Please verify and update with your findings
Hi Khiat,
I'm now able to click on the 'image' and see the image. It is not clear which table you are referring to. You mentioned in a tag that this is related to AX2012, but I'm not convinced yet.
The answer from Nitesh is almost correct. The mentioned table name by Nitesh is the Ledger transactions table in all AX versions until AX2009. The data model in AX2012 has been changed and the table where Ledger transactions are stored are two tables:
GeneralJournalEntry
GeneralJournalAccountEntry
The last mentioned table contains the link to main accounts and used dimensions and the amounts.
For this table and the LedgerTable from earlier versions, there are also a columns called 'IsCorrection' and 'IsCredit' (AX2009 'Correct' and 'Crediting').
If you enter a negative value in the credit column of a journal, both fields will be set to true.
In that case you can have a negative amount at the right side of this debit/credit column.
If you purely read from the database in x++ code you get the value positive or negative directly.
As it is not clear which table another not:
Some other tables also have the field IsCorrection/Correct to manage display of the debit/credit column.
Thanks all for trying to help, but Nitesh Ranjan solved my issue.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2