Is it possible to run a templater user script on a dataview code block?

I saw your post a little earlier on, but its been a busy day, so good for you that you found out of it. I first saw the Templater api referenced by @AlanG here: How to calculate my work hours - #8 by AlanG

And there he doesn’t pull out a single function like you do, which indeed is a neat trick, but he rather pulls out the “default” tp object:

const tp = app.plugins.plugins["templater-obsidian"].templater.current_functions_object

And then uses the various functions like you do in a template, like doing tp.system.prompt(). I kind of like that approach, but this a matter of personal preferences.

Whilst on a similar topic, I would also like to mention two alternatives which might be useful for other use cases:

So depending on your use case, either of these could be slightly better suited for the task at hand, but I just wanted to mention them to kind of broaden the view of alternatives available.

1 Like