Narration of Postings

105 views
Skip to first unread message

K O'Neill

unread,
Sep 4, 2020, 7:49:02 PM9/4/20
to Beancount
I thought it was possible to add narration to individual postings but I don't see any mention of that in the beancount documentation. I may be confused with ledger-cli's ability to add transaction notes to both postings as well as transactions.

Assuming narration is not possible, if I need more parsable detail added to postings, what would you recommend? I believe key:value pairs apply to entire transactions, and comments are ignored. So that would seem to leave my only options as tags and links? Neither of those seem right to use for one-off items though.

Thanks for your help!

Martin Michlmayr

unread,
Sep 4, 2020, 8:51:20 PM9/4/20
to bean...@googlegroups.com
* K O'Neill <pocket...@gmail.com> [2020-09-04 16:49]:
> I may be confused with ledger-cli's ability to add transaction notes
> to both postings as well as transactions.

Beancount has the same feature.

> I believe key:value pairs apply to entire transactions

Metadata (key:value) that are listed before the first posting are
attached to the whole transactions. Metadata after a posting is
attached to that particular posting, i.e. it works the same way as
ledger.

--
Martin Michlmayr
https://www.cyrius.com/

K O'Neill

unread,
Sep 4, 2020, 9:08:02 PM9/4/20
to Beancount
> I may be confused with ledger-cli's ability to add transaction notes
> to both postings as well as transactions.

Beancount has the same feature.

I understand beancount can add comments to postings. Are you suggesting that narrations are possible as well?  IIRC, ledger's transaction notes are rendered while beancount's comments are not.

 
> I believe key:value pairs apply to entire transactions

Metadata (key:value) that are listed before the first posting are
attached to the whole transactions. Metadata after a posting is
attached to that particular posting, i.e. it works the same way as
ledger.

Thanks, that's good to know. I see now it is documented as such. I guess I could use key:value pairs but it is a bit more cumbersome than simply attaching a narration to a posting.

 

Mefju

unread,
Sep 5, 2020, 2:24:06 AM9/5/20
to bean...@googlegroups.com
I also use narration for postings, and also miss that Beancount does not parse comments.

I use a “comment: ‹narration›" metadata now, but it would be good if next beacount could parse line comment and set it to the corresponding metadata for the “comment" key.

(I also tried “c: ‹narration›", for the sake of simplicity, but metadata keys must be at least 2 characters long.)

Máté.

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/c299f8d4-6737-4039-a48d-7ec350de7518n%40googlegroups.com.

Martin Michlmayr

unread,
Sep 5, 2020, 2:30:37 AM9/5/20
to bean...@googlegroups.com
* K O'Neill <pocket...@gmail.com> [2020-09-04 18:08]:
> > Beancount has the same feature.
>
> I understand beancount can add comments to postings. Are you
> suggesting that narrations are possible as well? IIRC, ledger's
> transaction notes are rendered while beancount's comments are not.

Oh, I see what you mean now. Sorry, no, beancount does not have that
feature.

Ledger allows you to put a ; Payee: metadata on a posting. In
beancount, there is only a payee for the whole transaction.

> > Metadata (key:value) that are listed before the first posting are
> > attached to the whole transactions. Metadata after a posting is
> > attached to that particular posting, i.e. it works the same way as
> > ledger.

> Thanks, that's good to know. I see now it is documented as such. I
> guess I could use key:value pairs but it is a bit more cumbersome
> than simply attaching a narration to a posting.

Well, a "attaching a narration to a posting" is using meta-data, it's
just that the "Payee" metadata has a special meaning in ledger and is
used to override the payee from the transaction header.

(That's why I was initially confused and said beancount has the same
feature.)

Martin Michlmayr

unread,
Sep 5, 2020, 2:33:09 AM9/5/20
to bean...@googlegroups.com
* Mefju <me...@farkas-mate.hu> [2020-09-05 08:23]:
> I also use narration for postings, and also miss that Beancount does not
> parse comments.

IHMO that's a feature and not a bug.

Ledger uses one syntax for comments and meta-data. This actually
makes things quite error prone.

Mefju

unread,
Sep 5, 2020, 3:48:38 AM9/5/20
to bean...@googlegroups.com
On Sat, Sep 5, 2020, 08:33 Martin Michlmayr <t...@cyrius.com> wrote:
* Mefju <me...@farkas-mate.hu> [2020-09-05 08:23]:
> I also use narration for postings, and also miss that Beancount does not
> parse comments.

IHMO that's a feature and not a bug.

That's definitely not a bug, it is by design, I checked the source code.

On the other hand I think there is information loss because of it. Beancount has a cool syntax to comment a transaction, a posting, unfortunately I cannot access it progmamatically. So I have to use the not so cool "put your comment in metadata" feature, so I can access it. (Having metadata is amazing by the way.)

K O'Neill

unread,
Sep 5, 2020, 5:39:46 PM9/5/20
to Beancount
Thanks for the help. So I guess the first step is defining my metadata key pn for post-narrations.

Then the next step would be to see if a plugin can be written to parse strings that come after the amounts and insert them into the pn metadata automatically. I don't believe such a plugin exists already. I've found various plugins here and there but no centralized directory of user plugins to confirm this. I hope that the plugin can suppress Parser errors.

Mefju

unread,
Sep 6, 2020, 8:58:57 AM9/6/20
to bean...@googlegroups.com
On Sat, Sep 5, 2020 at 11:39 PM K O'Neill <pocket...@gmail.com> wrote:
Thanks for the help. So I guess the first step is defining my metadata key pn for post-narrations.

You do not need to define, just start using it.
 
Then the next step would be to see if a plugin can be written to parse strings that come after the amounts and insert them into the pn metadata automatically. I don't believe such a plugin exists already. I've found various plugins here and there but no centralized directory of user plugins to confirm this. I hope that the plugin can suppress Parser errors.

It will be hard, since comments are dropped during the parsing phase by design.
I suggest filling the pn metadata manually. It is much easier than pre-processing a beancount file...

For example with "comment" metadata:

2020-04-29 * "Bauhaus"
  Expenses:House                    5,000.00 HUF
    comment:"Cutter"
  Expenses:House                    2,000.00 HUF
    comment:"Strings"
  Expenses:House                    1,000.00 HUF
    comment:"Duct tape"
  Assets:Bank                      -8,000.00 HUF


I still hope that eventually Beancount will be able to parse posting and transaction comments and put it into metadata, so I could use the following with the same meaning:

2020-04-29 * "Bauhaus"
  Expenses:House                    5,000.00 HUF ; Cutter
  Expenses:House                    2,000.00 HUF ; Strings
  Expenses:House                    1,000.00 HUF ; Duct tape
  Assets:Bank                      -8,000.00 HUF  


Mefju.
(Farkas Máté) 

Martin Blais

unread,
Sep 6, 2020, 11:57:17 PM9/6/20
to Beancount
Catching up on this thread.

I think I've commented before on posting-level comments, I like the idea though I've never needed it myself, but it would require new syntax, since comments are... well comments and will always be stripped.
I think ideally this is something that would 
- Use the same syntax for transaction level and posting levels
- The new syntax should also solve the problem of payee vs. narration ambiguity (one string vs. two strings... not great).
- Finally, the idea of coercing a set of pre-declared payees might be also in line with this change.

e.g.

 2012-01-01 * ~"payee" "narration"
  Assets:Bank:Checking   100.00 USD   "posting level narration"
  ...

Something like this.
If this is made free-form again (i.e., not using quotes) both syntaxes should be distinct from comments.
Whatever is done, should also be backward compatible.

So I don't know.
In any case, this is a matter for a big change, so v3 or beyond for sure.
In the meantime, use metadata.




--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages