Sunday, March 3, 2019

Behavior of Transaction Amount of Payables when Queried through ODBC

Transaction amounts almost always appear as a positive value when viewed from the user interface on the record itself and through saved searches, regardless of record type. However, when transactions categorized as payables (like vendor bills) are queried through ODBC, they return a negative value.

To prevent disparity in reports created through ODBC and those ran from a saved search or from canned reports from the user interface, use the SQL function ABS() to return the absolute value of the AMOUNT columns instead just like in the query shown below:

SELECT A.TRANSACTION_ID, ABS(B.AMOUNT)  FROM TRANSACTION_LINES B, TRANSACTIONS A
WHERE B.TRANSACTION_ID = A.TRANSACTION_ID AND A.TRANSACTION_TYPE = 'Bill'

No comments:

Post a Comment