Longer explanation: I’m building a database for story notes, and I have list-style property elements describing the content of each note.
I would like to limit which of these descriptive list-items displays in a table by keyword. This would declutter my table when I’m only interested in what a note contains pertaining to a specific topic or character.
Things I have tried
I’ve tried a lot of things over the past few days, mostly focused on the “flatten” and “group” functions paired with “contains(text, “text”) tools.
I’ve succeeded in limiting which FILES are displayed, but not which property tag appears in the table next to the file.
This is my first forum post, so please forgive any faux pas. I’ll happily provide more information if anything is unclear.
Also, if there’s a way to do what I’m trying to that’s better than using list-style properties, I’m open to that. I’m still learning to think in code blocks and don’t know all the tools available to me yet.
I have no idea if this is going to work or not (as I’m no Dataview expert ) but you could try to replace your Content field in your query by something like :
filter(row.concernedList, (s) => contains(s,"item to look for")) AS "Content"
Where row.concernedList represents the list of items in your “Content” field for the “current row” which is then filtered by "item to look for" (a keyword) and displayed as the value in the content field …
If it doesn’t work, don’t hesitate to share your actual query … It could be helpful .
Which is an issue that I keep running into and it’s driving me crazy. Any time something seems like it should work, it stops displaying the tags entirely.
Here’s a copy of my current code:
TABLE
Content
from [[]]
where contains(file.name,"Note")
Sort file.name
And here’s what the actual note page properties looks like, if it helps.
If I understand you’re request correctly then filter() is the missing peace to build a query where you’ll only want to see some of the tags based upon a list of keywords.
You can’t affect the main properties view though using a query. Either the properties are shown, collapsed or hidden. You can’t filter the properties view itself. (You could however hide it, and have queries displaying (not for editing) interesting parts.
So, I had to improvise a little when it comes to the query (as well, my vault is obviously different than yours ) but maybe this could give you a lead to follow …
At least, after creating 3 tests notes and adding a content key (of type list) to 2 of them…
… where the content key for both notes returned by the query are filtered using the keyword key (of type list again) at the top of the note .
The query I used is this one:
```dataview
TABLE
content AS "Content",
filter(content, (s) => any(containsword(s, this.keyword))) AS "Filtered Content"
WHERE contains(file.name, "Fay") AND file != this.file
SORT file.name ASC
```
This might still require some adjustments but isn’t the Filtered Content what you were trying to achieve ? (or something similar )
Sorry about the delayed response, my week got really crazy at the end.
Yes! The filtered content is exactly what I’m looking for! I’m trying to wrap my head around why your string works and how the keyword property is playing a part (again, still figuring out coding xD) but that’s what I need it to do!