Querying for single tags

Hey everyone. New user here. Been trying to do the following scenario:

What I’m trying to do

So in my Daily Notes, I like writing my Habits and Financial Records like this:


name:: [[Morning Routine]]
boolean:: 0
description:: “Stuff”

name:: [[Daily exercise]]
boolean:: 0
description:: “Description”

name:: [[Financial Tracker]]
boolean:: 0
description:: “Description”

name:: [[Night Routine]]
boolean:: 0
description:: “Description”

Financial Tracking

name:: “Finance Record”
account:: “Account Name”
credit:: 0
debit:: 0
payee:: “Payee”
description:: “Description”

So essentially, I populate my Daily Notes with these “records” of habits or financial-records.

After doing so, I am trying to query a table that will list all of my financial records, so that I can perform some calculations on them.

Things I have tried

TABLE name, name.account, name.credit, name.debit, name.payee, name.description, name.props
FROM #finance-record and -"template"

After running this, however, I get a table like this:

My query is also including blocks with the #habit tag.

Now, I understand that such query will query for all files that contain the given task, but how can I limit my query to return actual blocks that begin with the given task I want?


In Dataview tags and inline fields are either connected to the entire page, or to a list (or task) item. The way you’ve declared your inline fields, they all belong to the page scope, and there is no good way to differentiate between any of the “visually distinct” entries in your file.

One way to counter this would be to change to some sort of a list (or custom checklists) where it could look something like:

- #habit [[Morning Routine]] (boolean:: 0) (description:: Stuff) (props:: )
- #habit [[Daily exercise]] (boolean:: 0) (description:: Description) (props:: )

- #finance-record [name:: Finance record], [account:: Account name], [credit:: 0], [debit:: 0], [payee:: Payee], [description:: Description], [props: ]

Or some variant similar to these, I’m liking custom checklists, so I would probably do something like:

- [S] (name:: Finance record) ((account:: Account name)) – From (payee:: Payee): (description:: Description). [credit:: 0] / [debit:: 0]. [props:: ]

Displaying as:

In any case, using either lists or tasks like this, it would allow for queries like the following:

TABLE item.name, item.account, item.credit, item.debit, item.payee, item.description, item.props
FROM -"template"
FLATTEN file.tasks as item
WHERE item.status = "S"

Or using contains(item.tags, "#habit") if you’re not into custom checklists. Variation on the syntax and queries needs to be done according to how you like it setup, presented on depending on links, and so on. But in any case, you need to switch to a list/task setup to separate these entries into different “records”, which they simply put aren’t when just visually separated in the page scope.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.