-
-
Notifications
You must be signed in to change notification settings - Fork 69
Create Making Dynamic Dataview Queries.md #622
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
base: release
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,24 @@ | |||
# Making Dynamic Dataview Queries via Meta Bind | |||
A practical example showing how to dynamically populate MetaBind input fields using Dataview queries. This addresses the common use case of wanting to filter suggester options based on note properties, in ways that isn't possible with normal optionQuery. Will require adjustment based on your particular use case, but it's a place to start. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A newline after the heading would be nice
|
||
const property = "categories"; // frontmatter property to filter on | ||
const value = "character"; // value to match | ||
// Equivalent to the Dataview query WHERE categories = "character" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you say categories
equals character
|
||
// Query notes where the property contains the value | ||
const pages = dv.pages() | ||
.where(p => p[property] && p[property].includes(value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here you write value
in property
# Making Dynamic Dataview Queries via Meta Bind | ||
A practical example showing how to dynamically populate MetaBind input fields using Dataview queries. This addresses the common use case of wanting to filter suggester options based on note properties, in ways that isn't possible with normal optionQuery. Will require adjustment based on your particular use case, but it's a place to start. | ||
|
||
The code block here is the equivalent of making the query `WHERE {property} = "{value}"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence here is confusing.
Hopefully much better clarity now
I hopefully clarified the field name usage, and provided a much better example |
Example of using JavaScript to make dynamic Dataview queries in Meta Bind
I made this when normal optionQuery was limited for my use case. Couldn't find a similar example, so it might be a useful starting point for someone else.