obsidian-meta-bind-plugin
obsidian-meta-bind-plugin copied to clipboard
The ability to limit optionQuery results based on frontmatter data
Is your Feature Request Related to a Problem?
No response
Describe the Feature you'd Like
Currently optionQuery() only takes data sources input to limit the alternatives, but I need/want to specify notes more specifically, and would like to be able to restrict the options on frontmatter/property data as well.
Additional Context
No response
The current results are generated with dataview, so this would be a breaking change.
The current results are generated with dataview, so this would be a breaking change.
Can you just extend the dataview input/return to include the .where
attribute?
I am not sure I get what you mean. Could you elaborate?
I am not sure I get what you mean. Could you elaborate?
optionQuery("Glossary")
is equivalent to dv.pages('"Glossary"').
I am asking if the .where
can be used in addition to the dv.pages argument.
Like this:
dv.pages('"Glossary"').where(p => p.fileClass == 'Dimensions');
https://github.com/mProjectsCode/obsidian-meta-bind-plugin/blob/4dc698adac1563765bb429d4454e12f13e87c4d2/packages/obsidian/src/modals/SuggesterModalHelper.ts#L46C55-L46C108
That could actually work, the only downside is that this would require users to write JS expressions.
https://github.com/mProjectsCode/obsidian-meta-bind-plugin/blob/4dc698adac1563765bb429d4454e12f13e87c4d2/packages/obsidian/src/modals/SuggesterModalHelper.ts#L46C55-L46C108
That could actually work, the only downside is that this would require users to write JS expressions.
The where
works the same in datviewjs as it does in normal DQL, but DQL does have less words.
The query would be:
FROM "Glossary"
Where contains(fileClass, "Dimensions")
The where works the same in datviewjs as it does in normal DQL, but DQL does have less words.
https://github.com/blacksmithgu/obsidian-dataview/blob/3c29f7cb5bb76f62b5342b88050e054a7272667f/src/api/data-array.ts#L27
Are you sure about that?
The where works the same in datviewjs as it does in normal DQL, but DQL does have less words.
https://github.com/blacksmithgu/obsidian-dataview/blob/3c29f7cb5bb76f62b5342b88050e054a7272667f/src/api/data-array.ts#L27
Are you sure about that?
If you need an example....
Query One
Dataview
Table without ID
file.link, file.frontmatter.mathLink
From "Glossary"
Where contains(fileClass, "Dimensions")
Dataviewjs
const rows = dv.pages('"Glossary"').where(p => p.fileClass == 'Dimensions').map(p => [
p.file.link,
p.file.frontmatter.mathLink]);
dv.table(["Link", "mathLink"], rows);
Query Two
Dataview
Table without ID
file.link, file.frontmatter.mathLink
From "Glossary"
Where !contains(fileClass, "Dimensions")
Limit 10
Dataviewjs
const rows = dv.pages('"Glossary"').where(p => p.fileClass !== 'Dimensions').map(p => [
p.file.link,
p.file.frontmatter.mathLink]).limit(10);
dv.table(["Link", "mathLink"], rows);