This could be something people might be interested in.
There are things you can query within Obsidian only, e.g. (lack/number of) backlinks. You cannot do this in VSCode or other text editors.
So how to update Properties (YAML fields) only in certain files, in the results of a query (in this case, a DataView query)?
Late last night, I fiddled with the Projects community plugin, looking for a solution.
(As far as I know, the MetaData Menu plugin makes it possible to update DataView table properties one by one, but I might be wrong.)
The challenge is to update Properties or fields of potentially hundreds of files. For example, tags. But only tags of files in which we matched some query criteria.
E.g. I fed this DataView query to Projects:
TABLE file.inlinks as Backlinks, length(file.inlinks) as Total, join(file.tags, " ") as Tags
FROM "X"
WHERE !econtains(flat(list(file.tags)), "#dg_uploaded")
AND !econtains(flat(list(file.tags)), "#nopublish-formattedš¢")
AND length(file.inlinks) = 0
SORT length(file.inlinks) DESC
- This will give you a table listing files with no backlinks filtered by tags not present in these files.
I chose the folderX
for the sake of simplicity, because I knew a limited number of files will crop up here.
Unfortunately, in Projects, I didnāt find a way to update the tags in bulk:
I donāt see an option for it.
A workaround would be to add a field, which could be used to match with regex captures outside of Obsidian (with VSCode, Notepad++, whatever), then update the tags with regex and delete the dummy field created in Projects.
So my question is: how do you update Properties in batch based on custom queries with DataView or otherwise?
Am I missing something?
Are we bound to some workarounds and regex hocus-pocus?
The hocus-pocus part:
- I botched this up, as I should have catered to different cases for formatted and unformatted, but you get the idea.