A User's view of Hledger

Learning about hledger

Traveling down memory lane with PTA data

This week, my plain text accounting data brought back some fun memories.

It all started when, a couple of days ago, we visited a chain restaurant and wondered when the last time we had eaten at one of these. We knew that it had probably been a year or more, but when was it? And where?

Back home, I searched my hledger data. 2024, nothing. 2023, nothing. 2022: two hits, one in July and one in September. In case you are interested, I used the following hledger command in my search:

hledger -f 2022.hledger areg liabilities payee:"[NAME OF RESTAURANT]"

Note re the above: I used “liabilities” as the category name, as I guessed (correctly) that I had used a credit card for the transaction. Since all credit card charges are a sub-category of “liabilities,” the above command finds any credit card charge no matter which card was used.

I then switched tactics to get more information and used the command:

hledger -f 2022.hledger print liabilities payee:"[NAME OF RESTAURANT]"

The above gave me more information, including the specific credit card I had used. I found some additional information online for that particular credit card, specifically the city where the restaurant was, but only for the September charge. There was no information for July, I think because the credit card company doesn’t show data after a certain point in the past, and July of 2022 was too far in the past.

However, my hledger data could tell me more. This is because I categorize travel in the U.S. as expenses:travel:domestic. So, I can identify many details about the trips by looking at the expenses for my 2022 travel. The command I used was:

hledger -f 2022.hledger print travel:domestic -b2022-07-01

A couple of notes about the above: I could have provided an end date, but it worked fine for me without one. If I had had many more transactions for travel in 2022, I might have needed to set an explicit end date earlier than the default one of December 31. (It’s December 31 in my case as my 2022 file contains transactions only for 2022.) However, the above command gave me what I needed without it being lost in a deluge of data, so no modifications to the command were needed.

One neat thing was that, by seeing all the other travel charges, I was able to remember on which trip each of the restaurant visits in question (i.e., the one in July and the one in September) took place. It was a nice stroll down memory lane remembering details of our travel such as who we visited, where we stayed, and other fun details of our trips.