Dataview: Display Status for individual file after grouping through tags

What i’m trying todo

Hello, please help me display status for individual file after grouping through tags

  • My dataview queries:
TABLE WITHOUT ID Tags AS "Categories", rows.file.link AS "Files", Status as "Status"
FROM #Chemistry/General-chemistry_GC AND "Cards"
FLATTEN file.etags AS Tags
WHERE contains(Tags, "#Chemistry/General-chemistry_GC/")
GROUP BY string(map(file.etags, (t) => split(t, "/")[length(split(t, "/")) - 1])) AS Tags

Have you tried using “rows.Status” instead of just “Status”? Using “Status” without “rows.” will assume a group’s status instead of the individual file’s status.

1 Like

Hello, this works perfectly, thank you so much for answering.

But can i ask you 1 more things. Since i change to another code that are much easier to understand. This dataview queries is working well but only 1 problem. How can i display tag as subtag only, like “#Academics/Chemistry/General-Chemistry_GC/chaos” into “Chaos” only

  • My dataview queries:
TABLE WITHOUT ID Tags AS "Categories", rows.file.link AS "Files", rows.Status AS "Status"
FROM #Academics/Chemistry/General-chemistry_GC 
FLATTEN file.etags AS Tags
WHERE contains(Tags, "#Academics/Chemistry/General-chemistry_GC/")
GROUP BY Tags
SORT Tags DESC

image

  • Please help me, i have searched reddit and obsidian forum but neither have gave me an answer since it really complex.

Sure thing, instead of writing TABLE WITHOUT ID Tags AS Categories, ... you write it as follows:

TABLE WITHOUT ID map(Tags, (t) => regexreplace(t, ".*/(.+)", "$1")) AS Categories, ...
1 Like

Hello, thank you for answering. After i add, dataview show this error:
image

  • Queries:
TABLE WITHOUT ID map(Tags, (t) => regexreplace(t, ".*/(.+)", "$1")) AS Categories, rows.file.link AS "Files", rows.Status AS "Status"
FROM #Academics/Chemistry/General-chemistry_GC 
FLATTEN file.etags AS Tags
WHERE contains(Tags, "#Academics/Chemistry/General-chemistry_GC/")
GROUP BY Tags
SORT Tags DESC

That’s because you’re using the “Tags” property with a single string instead of a list of multiple tag strings. In this case you write it as follows:

TABLE WITHOUT ID regexreplace(tags, ".*/(.+)", "$1") AS Categories

However, the “Tags” property is in plural form, so it’s not ideal to use it with a single string, it’s designed to be used with a list of multiple strings/tags.

1 Like
  • My dataview right now:
    image

This work perfectly. Thank you so much for replying multiple time! Hope you a wonderful day! :four_leaf_clover:

1 Like

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