Page 1 of 1

Ledger Transfer

Posted: Fri Feb 23, 2024 9:28 am
by tkoenitzer
I'm having trouble finding a specific field in the database. It's the "Transferred To" field under Transfer In section of a ledger transaction.
ledgertransfer.PNG
ledgertransfer.PNG (77.06 KiB) Viewed 1000 times

Re: Ledger Transfer

Posted: Mon Feb 26, 2024 7:40 am
by brandon.ritchie
The ledger transfers To/From (FTO / FTI) are linked by the related transaction ID. For the current transaction you can find the related transaction ID in the pt.TransactionExtened table (RelatedTransactionID). This will join back to the corresponding transaction/ledger to get the other side of the transfer.

Example:
SELECT
T.ID AS TransactionID,
L.Name AS TransferOutFrom,
T.Kind,
T.Amount,
TE.RelatedTransactionID,
L2.Name AS TransferInTo,
TTF.Kind,
TTF.Amount
FROM
pt.[Transaction] T
INNER JOIN pt.[Ledger] L ON T.LedgerID = L.ID
INNER JOIN pt.TransactionExtended TE ON TE.ID = T.[GUID]
INNER JOIN pt.[Transaction] TTF ON TE.RelatedTransactionID = TTF.ID
INNER JOIN pt.[Ledger] L2 ON TTF.LedgerID = L2.ID
WHERE
T.IsCurrent = 1
AND T.Kind = 'FTO'

Re: Ledger Transfer

Posted: Tue Mar 12, 2024 11:19 am
by tkoenitzer
Thanks!