When I reconcile accounts, one important first step is to add new transactions. In my case, I add just the posted transactions on an account. That is, I ignore any pending transactions until they become actual ones. While I see the pending transactions in my account statements, I don’t add the pending transactions to hledger.
Except last week I added several pending transactions by mistake. I added them along with the posted transactions. What to do? If I ran the aregister command as I normally do, it would add in the pending transactions, and the total won’t be correct to compare against the bank statement (which shows the total for posted transactions only).
My solution? I first considered commenting out all the pending transactions. But I didn’t like that idea as it seemed there must be a simpler solution.
Indeed there was. I marked the “real” transactions as reconciled, even though they weren’t. I ran the aregister command with the -C flag, to limit itself to the reconciled transactions. Thankfully, aregister agreed with the bank statement, so that meant that there were no errors in the posted transactions.
However, what about the pending transactions I entered? Perhaps there was an error there. How to tell? I ran the aregister command again but with the -U flag, with the result that it reports only on unmarked transactions. In this case, only the pending transactions were unmarked, so I got exactly what I needed. I then compared the total from aregister with the bank statement, which gave a total of the pending transactions. If there had been a difference between the aregister command with the -U flag and the bank’s total for pending transactions, I would have known that there had been a mistake. And I would have known that the mistake was in the latest group of pending transactions.
It’s worth noting that hledger has a specific symbol, the exclamation mark, for pending transactions. In my case, leaving the transactions unmarked seemed to work fine. However, it’s good to know that sometime in the future it may be useful to use the exclamation mark for pending transactions.