Create Making Dynamic Dataview Queries.md#622
Closed
michaelptak wants to merge 2 commits intomProjectsCode:releasefrom
Closed
Create Making Dynamic Dataview Queries.md#622michaelptak wants to merge 2 commits intomProjectsCode:releasefrom
michaelptak wants to merge 2 commits intomProjectsCode:releasefrom
Conversation
mProjectsCode
requested changes
Sep 21, 2025
| @@ -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. | |||
Owner
There was a problem hiding this comment.
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" |
Owner
There was a problem hiding this comment.
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)); |
Owner
There was a problem hiding this comment.
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}"` |
Owner
There was a problem hiding this comment.
This sentence here is confusing.
Hopefully much better clarity now
Author
|
I hopefully clarified the field name usage, and provided a much better example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.