Query that excludes links in another page (aka dataview's 'outgoing' rule)

I have a list for films that Terry and Lucie might like (“Terry Lucie”).
I have another list of films they have already seen (“Terry Lucie Saw”).
When they come over for the weekly film night, I choose from the first list, which excludes everything in the 2nd list. Works great but for one thing: when I open the md file directly through Win Explorer, instead of seeing a list of films that I can choose from, I see the dataview rules:

table from #filmtitle and !outgoing([[Terry Lucie Saw]])
where contains(lists, "Terry") or contains(lists, "Lucie")
sort file.name

So I decided to use Obsidian query instead, so that I could copy paste the results, and just redo the query before they came over just to update it. But…

:question:I don’t know how to add the “and !outgoing([[Terry Lucie Saw]])” part into this query:

tag: #filmtitle (line: (lists Terry) OR line: (lists Lucie))

… and the file is not a link in the Terry Lucie Saw page.

Is it possible with Obsidian search (aka query) or must I stick with Dataview and just deal with the fact that many of my md files will be useless when opened via explorer.

you could export a dataview table as csv with the “table to csv exporter” plugin, or, if you want to get really advanced, it’s possible to use templater to bake out the results of a dataview or dataviewjs query, though it’s on the advanced side of things.

cheezopath, it’s actually what I do now. I use templater to call a template that includes dataviewAPI calls, and it ‘prints’ the results directly in my page. Ideal but for having to create so many specific templates everywhere…

is it possible to pass a generic templater user function a dataview query string to execute inside, then put that template on a hotkey?

That’s the question.

I think I got this working.

First in your frontmatter, add a dataview query string, eg:

query: 'LIST LIMIT 3'

make dvbake.js in your templater scripts folder:

async function bake (tp,qstring) {
    const query = await app.plugins.plugins.dataview.api.queryMarkdown(qstring)
    let result = query.value
    return result
module.exports = bake;

Then you can use this templater code:

<% tp.user.dvbake(tp,tp.frontmatter["query"]) %>

Which you can bind to a key. Now any time you hit that key, if the note you’re on has query in the yaml, it’ll bake out the dataview as markdown.

EDIT: I guess tp.frontmatter is already being passed in via tp… well anyway you get the idea, you can simplify it