List Items by tag in chronological order for a journal

What I’m trying to do

Context

  • I create lists in my journal, each item marked with a distinct tag (or not)
  • Each item on the list may encompass subsidiary points, some of which are also assigned specific tags

An example would be

- Bullet Item 1 #this/tag1
- Bullet Item 2 #this/tag2
	- Bullet Item 2.1 #that/tag1 
	- Bullet Item 2.2 #that/tag2
		- Bullet Item 2.2.1 #that/another-tag
		- Bullet Item 2.2.2 
		- Bullet Item 2.2.3
			- Bullet Item 2.2.3.1 #that/random
		- Bullet Item 2.2.4
	- Bullet Item 2.3
		- Bullet Item 2.3.1 #that/sqaure
	- Bullet Item 2.4 #that/tag3
- Bullet Item 3
	- Bullet Item 3.1 #this/zap

What I would like to achieve

From this, I would dataview to be able to generate a table showing the breakdown of tags & tag content. Each tag has entries sorted by time, giving a neat “chronology” of entries for that tag

The following rules should be applied
  • Rule1 If a tag is part of a bullet point with sub-items, then all sub-items (and their children) must be displayed with the tag.

  • Rule2Items with a tag must be displayed alongside their own tag, even though they may have been pulled up to be shown in the context of a parent point with its own tag

  • Rule 3 If an item with a tag is a child of an item without a tag, the parent must be pulled along with it

  • Rule 4 For items that have no tag and where a tag cannot be inherited from their parent, they should appear at the top or bottom of the table. Those entries should show that no tag exists (or just remain blank)

Things I have tried

After dedicating 45+ min to this unsuccessfully, I came to the view that the sole solution might involve the utilisation of ‘dataviewjs’.

I got this far with a normal query:

TABLE WITHOUT ID year, week, day, item.tags, item.text, item.children.text
FROM #je
WHERE !(contains(file.folder, "__inbox") OR contains(file.folder, "_all-dashboards") OR contains(file.folder, "_all-obsidian"))
FLATTEN filter(file.lists, (fl) => length(fl.tags) > 0) as item
SORT item.tags, year asc, week asc, day asc

What I’m really asking

Should anyone have put in effort to accomplish something akin to this, I would be appreciative to receive a copy. I am more than willing to express my thanks with a cup of coffee, if necessary :slight_smile:

Thanks

1 Like

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