Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List from tag 1 exclude tag 2 #44

Closed
filmgal opened this issue Mar 18, 2021 · 5 comments
Closed

List from tag 1 exclude tag 2 #44

filmgal opened this issue Mar 18, 2021 · 5 comments

Comments

@filmgal
Copy link
Sponsor

@filmgal filmgal commented Mar 18, 2021

I don't think there's a way to say:
list from #dessert but not #icecream

I've tried a few ways to no avail.
Something like this would be so useful.

This is probably a separate issue, but a way to say does not contain would also be great.
list from #dessert
where !=contains(file.name, "Ice Cream")
or something like that.

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Mar 19, 2021

Both are possible - for the first, negation is done via the minus sign ("-"), so

LIST FROM #dessert and -#icecream

For the second, use "!" for negation:

LIST FROM #dessert WHERE !contains(file.name, "Ice Cream")

The negation operator being different in both cases is a little wierd. Will add support for "!" in both cases so you don't need to remember the sublety.

@SkepticMystic
Copy link
Contributor

@SkepticMystic SkepticMystic commented Mar 19, 2021

I was also a little confused about excluding tags. The minus - syntax didn't occur to me. Thanks for supporting both options

@liamcain
Copy link

@liamcain liamcain commented Mar 20, 2021

Related:


I also just discovered that ! works when checking for null/undefined in YAML objects. I just created the following frame for example:

table file.mtime as Modified 
from #task
WHERE file.name != "TODO" and !completed_at
sort file.ctime desc

which properly filters out notes that contain completed_at in the YAML

e.g.
image

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Mar 20, 2021

That's right. In WHERE blocks, I follow JavaScript style "truthiness", so null values are considered false. Thus, negating a null/undefined value yields true.

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Mar 23, 2021

Added support for '!' in front of sources as well, so you can use it for everything. I can't use '-' in fields, since that could also mean numeric negation.

artyhedgehog added a commit to artyhedgehog/obsidian-dataview that referenced this issue Aug 12, 2021
Source: blacksmithgu#44

Couldn't find how to exclude tags until searching issues - hence proposing an addition in docs.
blacksmithgu added a commit that referenced this issue Aug 13, 2021
Source: #44

Couldn't find how to exclude tags until searching issues - hence proposing an addition in docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants