links, vs tags vs meta

80 views
Skip to first unread message

Chary Chary

unread,
Jun 4, 2024, 6:11:57 AMJun 4
to Beancount
Dear all,

I am just trying to find the best solution for grouping postings in addition to them  being grouped by accounts.

Just want to check my understanding

The obvious choices are are  links,  tags and meta

From your experience are there any specific reasons one would use one over another:

2020-01-01 open Assets:Cash
2020-01-01 open Expenses:Food

2020-01-01 * "Buying something with tag "  #some-label #some-label2
    Assets:Cash  -100.00 USD
    Expenses:Food

2020-01-01 * "Buying something with link"  ^some-label ^some-label2
    Assets:Cash  -100.00 USD
    Expenses:Food

2020-01-01 * "Buying something with meta"
    label: "some-label"
    Assets:Cash  -100.00 USD
    Expenses:Food


My comparison table is | tags | links | meta
-----------------------------------------------------
can be filtered by in beanquery               |   Yes     |  Yes       | No
--------------------------------------------------------------------------------------------
Can be several ones in one transaction  |    Yes    | Yes       | No
--------------------------------------------------------------------------------------------
can be grouped by in beanquery            |    No     | No         | Yes
          

So, so far my conclusions are:

tags and links are pretty much the same (??? did I miss some difference ??)
If you need filtering by                       - use tags or links
if you need grouping by and filtering - use meta

Any comments?


Chary Chary

unread,
Jun 4, 2024, 7:37:34 AMJun 4
to Beancount
Sorry,

correction to comparison table

                                          | tags | links | meta

----------------------------------------------------------------------

can be filtered by in beanquery             |  Yes Yes   | Yes No

--------------------------------------------------------------------------------------------

Can be several ones in one transaction      |  Yes | Yes    | No

--------------------------------------------------------------------------------------------

can be grouped by in beanquery              |   No | No     | Yes

Daniele Nicolodi

unread,
Jun 4, 2024, 1:54:33 PMJun 4
to bean...@googlegroups.com
Links, tags, and metadata are facilities provided by beancount that do
not really have a strictly defined role: they are building block for
different workflows.

Links are tags both allow to attach labels to transactions. As the name
implies, links are generally used to link related transactions, tags are
generally used for classification. Tags can be applied to a group of
transactions with the "pushtag" and "poptag" directives. Links do not
have a similar mechanism.

Metadata allow to attach key-value pairs to transactions (and many other
ledger entries). Usually metadata is used for recording structured
information.

> correction to comparison table
>
>                                           | tags | links | meta
> can be filtered by in beanquery            | Yes | Yes   | Yes
> Can be several ones in one transaction     | Yes | Yes   | No
> can be grouped by in beanquery            | No | No    | Yes

I'm not sure I understand how you define these properties.

Metadata fields cannot be lists, but you can have as many metadata
fields attached to one transaction, thus there "can be several meta in
one transaction".

You cannot group by the `links` or `tags` columns in bean-query, but you
cannot group by the `meta` column either. You can group by the value of
a specific metadata field, but you can also group by the presence of a
specific link or tag. Therefore I don't understand what you mean with
the last line.

Cheers,
Dan

Chary Chary

unread,
Jun 4, 2024, 3:43:48 PMJun 4
to Beancount
Dan,

thanks for a good summary!

When I say, that tags and links  cannot be grouped by in beanquery    I mean, exactly what you said, that you can't use GROUP BY tags or links like you can with meta (e.g. GROUP BY entry.meta['invoice'] )

It is a good point, that it is possible to group by a presence of a certain tag or link
Reply all
Reply to author
Forward
0 new messages