Conditional extraction from bullets in flattend query

Hi, I have a working query that I would like to extend. I have on every journal page a section in which I want to write down ideas for certain topics using hashtags. So it would look something like this:

# Notes
- #hastagone This is a note
- #hastagtwo this is another note

I have a query which gives me a nice list of all notes, but I would like it to only extract the bullets with a certain hashtag. Here is my current query.

rows.bullets.text as Journal
FROM #journal
FLATTEN file.lists as bullets
WHERE meta(bullets.section).subpath = "Notes" AND file.ctime.year = 2024
SORT file.ctime DESC
GROUP BY as "Day"

How can I add the condition to only extract the bullets from ```rows.bullets.text```` that contain a defined hashtag?


Try exchanging rows.bullets.text with

filter(rows.bullets, (b) => contains(b.tags, "#hastagone")).text

Update: Missed a quote character after the tag

Thank you, but that throws a parsing error. Your suggestion looks like dataviewjs.

Hehe, it is standard DQL, but it do look a little like dataviewjs. I see that I mused a quite after #hastagone, it should be "#hastagone".

I’ll update my main post.

Thank you. It works!

I have some questions regarding cosmetics. Now it does what it should do, but it shows now the dates when they are “empty”. So when no #hashtagone is there, it shows nothing. Is there a way to add a condition to only show it if isn’t empty? Thanks

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