question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

file.tags vs tags(frontmatter)

See original GitHub issue

Describe the bug Using GROUP BY / FLATTEN in dataview query I’m able to obtain the expect result if work with “tags” via frontmatter (except the fact that the tag not be an ‘active/clickable’ element). That’s not possible with “file.tags”.

To Reproduce

  1. Query with “tags”:
TABLE join(rows.file.link, ", ") AS Files
WHERE tags
FLATTEN tags
GROUP BY tags
Group Files
tag1 File A
tag2 File A, File B
tag3 File C
tag4 File A, File D
tag5 File D
tag6 File A, File C, File D

The table is grouped as wanted - tag by tag -, although tags are not ‘active’ elements.

  1. Query with “file.tags”
TABLE join(rows.file.link, ", ") AS Files
FROM "Teste2"
WHERE tags
FLATTEN tags
GROUP BY tags
Group Files
#tag1
#tag2
#tag4
#tag6
File A, File A, File A, File A
#tag2 File B
#tag3
#tag6
File C, File C
#tag4
#tag6
File D, File D

The table isn’t grouped as wanted - tag by tag -, although tags are now ‘active’ elements.

Expected behavior A mix of the two previous results: a table grouped as in case 1 with ‘active’ tags as in case 2.

Desktop (please complete the following information):

  • OS: macOS BigSur
  • Obsidian Version: v0.12.15
  • Dataview Version: 0.4.8

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
blacksmithgucommented, Sep 12, 2021

This mostly appears to be a UX problem with GROUP BY doing something stupid with variables with dots in them. I may be able to fix the behavior.

2reactions
blacksmithgucommented, Sep 12, 2021

Ah, the reason your second query is due to a bad Dataview interaction with how GROUP BY works - it makes a variable literally called "file.tags", which you have to obtain via row["file.tags"]. I would use GROUP BY file.tags AS tag to rename it to something usable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

YAML tags vs Normal tags in Obsidian : r/ObsidianMD - Reddit
I would like to use YAML tags for dataview (also heard that Tags in… ... the front matter (and do another things to...
Read more >
Front Matter | Jekyll • Simple, blog-aware, static sites
The front matter must be the first thing in the file and must take the form ... use Liquid tags and variables but...
Read more >
Tags and frontmatter - Feature requests - Obsidian Forum
I have a use-case where I am using Obsidian to write the content that will be presented via mkdocs which has caused some...
Read more >
Front-matter | Hexo
Only posts support the use of categories and tags. Categories apply to posts in order, resulting in a hierarchy of classifications and sub- ......
Read more >
Creating Tags Pages for Blog Posts - Gatsby
You add tags by defining them in the frontmatter of your Markdown file. The frontmatter is the area at the top surrounded by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found