Modify a Dataview Query using a Meta Bind Button?

Hello, I am trying to modify a dataview query to change using a metabind button.

My idea: have a dataview query and a meta bind button and when the button is clicked it will pop up a modal that will ask for a note and it will add the note to the query and when the modal closes the FROM query modifies to add the note.

Say I have:

TABLE name, location, tags
FROM Placeholder

and I hit the button and say to add [[car keys]] the query would change to

TABLE name, location, tags
FROM Placeholder OR [[car keys]]

I am willing to switch to js and but so far havent figured out how to even link a variable from a button script to a dataview script

I’ve not heard of any attempts to modify the query itself, but I reckon this should be easily doable using properties from within the query. I’ve not handled the Placeholder part which either needs to be moved into the WHERE clause, or by default include any files you might have in sources.

The following query is untested:

```dataview
TABLE name, location, tags
WHERE contains(this.sources, file.link)
```

This query depends on a property like the following:

sources:
- "[[car keys]]"

And that property should be easily handled by a metabimd button.

Note: Since this means the query itself doesn’t change, but its sources might, you might be triggering the bug of the query not updating. If that happens you’ll either need to reopen the note with the query or trigger a command to rebuild the view

I actually like this a lot. I seem to be overriding the property instead of appending it but this is a great solution to my issue thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.