Is there any way or plugin to mark a note as incomplete while the filename and certain properties are missing?
You could script this relatively easily. I would script it and add the command into Obsidian using the shells command plugin if I had this need.
Because I don’t know how computer-savvy, I want to offer a partial solution and introduce you to the Metadata menu plugin. This will not notify you, but it is the infrastructure you can use to have complete information in your metadata. You create classes and declare what properties are expected of a class of notes. Then, you use the plugin to insert one or more of the missing fields in your note.
Thanks, this plugin is useful, but it doesn’t do what I need. Not right now, at least.
I create the note from a template where I’ve defined the properties, so the fields are already there, empty. what I’m looking for is a plugin that highlights my note until I’ve filled in certain fields that I’ve set as mandatory.
So as to avoid forgetting fields.
You mean like dataview with a proper query?
I believe the better option for you would be to have a dedicated note with a query showing you which fields have not been filled out yet. Something like the following could be used:
```dataview
TABLE
choice(these, "<span style='color: grey'>ok</span>",
"<span style='background-color: red'>TODO</span>") AS these,
choice(are, "<span style='color: grey'>ok</span>",
"<span style='background-color: red'>TODO</span>") AS are,
choice(my, "<span style='color: grey'>ok</span>",
"<span style='background-color: red'>TODO</span>") AS my,
choice(fields, "<span style='color: grey'>ok</span>",
"<span style='background-color: red'>TODO</span>") as fields
WHERE file.folder = this.file.folder AND file != this.file
WHERE !these OR !are OR !my OR !fields
SORT file.name DESC
```
It seems complicated, but it’s actually just a matter of copying the same two lines over and over, changing the field name, and then make the next to last lines also includes every field name you want to check against. Styling is optional and can be whatever you feel like.
In my test scenario the file t760117 test
with all fields filled out like this:
And all the other files missing bits and pieces according to binary counting (with columns in reverse order :-D) displays as:
So you’ve got some work in almost all of the files marked by the TODO
text…
This is the variant where it showcases which fields are missing any text, you could also go two different paths. You could either choose to just list all files having missing fields using just the WHERE !these OR !are OR ...
where clause, or you could go into the realm of dataviewjs and based on a query like the one above could actually change each of these fields to have an extra property declaring it’s an incomplete file.
I’m thinking the latter of these would be superfluous, as the table does indeed show which files you need to focus on, and adding that “add incomplete property” will actually make the query/script a lot longer for little or no real gain.
Another idea, though, could be to add a number counting how many fields are missing, and use that for prioritising. But then again, you do get a strong visual clue with proper formatting, as an all empty fields file would light up in the table quite strongly.
Good, 2 questions:
- How do I do if my fields contain spaces?
- Is there any way to list (in an array) the fields I intend to query on and then repeat the choice line as many times as necessary?
Something like this
$fields={there, are, my, fields, and my composite fields}
for each $f in $fielss => choice($f, "<span style='color: grey'>ok</span>", "<span style='background-color: red'>TODO</span>") AS $f,
WHERE file.folder = this.file AND file != this.file
WHERE !$fields
SORT file.name DESC
I love spaces, sorry
And one small problem: it works on fields but not on paragraphs, for example I want something other than a blank line to always be written under certain titles and have a certain length:
# My important paragraph
Something very important
# Other paragraph
OK
# My important paragraph
# Other paragraph
NO
# My important paragraph
# Other paragraph
NO
# My important paragraph
😠
# Other paragraph
NO (too short)
You’ve got two options for this according to the documentation on fields with spaces in the name, and that is to:
- Use the normalized Dataview name for such a field - just convert the name to lowercase and replace whitespace with dashes (“-”). Something like
Field With Space In It
becomesfield-with-space-in-it
.- Use the implicit
row
field:row["Field With Space In It"]
You could try something along the lines of the following query:
TABLE
a[0].text as These,
a[1].text as Are,
a[2].text as "My fields",
a[3].text as "To write"
, a.condition
WHERE file.folder = this.file.folder AND file != this.file
FLATTEN list(
map( list(these, are, row["my fields"], econtains(file.etags, "#toWriteTag")),
(m) => object(
"condition", m,
"text", choice(m,
"<span style='color: grey'>ok</span>",
"<span style='background-color: red'>TODO</span>")) )) as a
WHERE !all(a.condition)
LIMIT 20
This also checks whether the tag #toWriteTag
is present …
It’s not readily available to check on contents of paragraphs or not, so my suggestions as hinted to above is to insert tags which you replace as you write those paragraphs. You could either use one generic tag like #toWriteTag
, or you could use specific tags like #sectionHabit
, #sectionImportant
if you’d like to separate out that you do need to write multiple paragraphs.
A final note on this query is that I’ve limited it to the current folder and not this file. I would in general not run this on an entire vault since we don’t limit the WHERE
clause before after checking and building the result, so please do restrain the query so it only runs on the files you want to check for consistency. And the LIMIT 20
further refrain the query to run or try to display the result for all the files of your vault (like it did for me at one point… )
Thank you. I guess it is not possible to avoid writing 2 times the list of fields
Not really, you could possibly make somethong by building the query within a dv.view()
, but that’s a whole other story, and it’s more complex and harder to setup initially.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.