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

FR: Add filter field to the code blocks #262

Closed
HEmile opened this issue Jan 11, 2022 · 10 comments
Closed

FR: Add filter field to the code blocks #262

HEmile opened this issue Jan 11, 2022 · 10 comments

Comments

@HEmile
Copy link
Collaborator

HEmile commented Jan 11, 2022

The code blocks are great! One caveat though is that they can get real big. And sometimes I want to query very specific things! Is it possible to add a filter field?

One option could be to just use a Dataview query here, if you don't feel like implementing any annoying filtering options. Not sure how hard that would be. Maybe you can run both queries, and then compute their intersection.

@SkepticMystic
Copy link
Owner

I can definitely do that! That's what the fields field is for, I just haven't implemented it yet.
Btw, your issue you mentioned on the Discord is caused by this #265. Before I fix it, you can just add fields: <field> where <field> is any field in your hierarchies. It will just bypass the error

@HEmile
Copy link
Collaborator Author

HEmile commented Jan 11, 2022

To be sure, this is a different request to what I asked on Discord. Ie: I don't mean selecting specific hierarchies (what I think fields is for, but more fine grained filter on eg tags, title, path... etc. The things you'd query in Dataview.

@SkepticMystic
Copy link
Owner

@HEmile would this cover your FR: #266

@SkepticMystic
Copy link
Owner

So fields would allow you to filter specific fields in the chosen dir.
where will allow you to interact with the metadata on each result

@HEmile
Copy link
Collaborator Author

HEmile commented Jan 11, 2022

Yes, pretty much. The suggestion here is that you use Dataview queries inside the where field so that you don't have to implement a new filtering syntax.

@SkepticMystic
Copy link
Owner

How do you mean? Can I feed a query into it's API?

@SkepticMystic
Copy link
Owner

It seems api.pages() can query for tags or folders, but not for fields
https://blacksmithgu.github.io/obsidian-dataview/api/code-reference/

@HEmile
Copy link
Collaborator Author

HEmile commented Jan 11, 2022

Hmm, I expected DV to have implemented this by now, but you're right, it can only find Sources but not WHERE queries https://blacksmithgu.github.io/obsidian-dataview/query/sources/

@SkepticMystic
Copy link
Owner

Yeah... I don't think it'll be too hard to parse... I say that now

@SkepticMystic
Copy link
Owner

There is an FR for a where field #266, and a from field has been implemented, so I'm gonna close this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants