This is the easier part. If the there is no text then the $Text attribute is empty. This query will find such notes:
You can even use the short-form test version of the same:
[Edit - code error!]
I’d use the first until you understand the process but do read the link about the latter as it helps you write more succinct code once you’ve more experience with action code queries.
Do bear in mind that the above matches every note with no $Text. It may be you only really want to match ‘content’ notes in your zettelkasten. Let’s assume—by way of example—that all such notes have a common prototype. For this example I’ll call it ‘pZettel’. Now we can restrict the scope of the notes tested for having text:
$Prototype=="pZettel" & $Text==""
The order is important. First we match only notes with the desired prototype (ignoring all other notes) then we test only those already-matched notes for their text. If you can, it always helps to test as few notes as possible when using operators employing regular expressions like
.contains(). In the above examples, were we using as
$Text.contains() type argument the last, pre-filtered version would be snappier.
This is a good reason not to use a root-level map. If all your work/content is under a single root container, then querying using
descendedFrom() on that container means all back-of house stuff like prototypes, templates, etc., are automatically excluded from the rest of the query. I often use a prototype in some projects just so I can address only those notes in a query.
This is a bit harder as you need to test each of the attributes. Let’s assume you have $StringA, $StringB and $StringC that you need to test. We’ll cement good practice here by using a prototype as an initial filter, but you don’t have to do this. You could test them one at a time:
$Prototype=="pZettel" & $StringA==""
Then repeat for $StringB, etc. As you fix incomplete $String A do check the other two attributes (e…g. ass Displayed Attributes) so the subsequent queries will return fewer items as you’ll already have fixed some notes. Tip: if you know there are more errors for, say, $StringB, test that one first and you may find you’ve pretty much fixed all 3 attribute via that first agent. I’d not make 3 agents, but one, fix all the errors, then change the query, etc. When done delete the last agent which should now be empty as all the attribute values are now fixed.
Or, you could do one query:
$Prototype=="pZettel" & ($StringA=="" | $StringB=="" | $StringC=="")
\ means an ‘OR’ join and the parentheses means these are all processed and the result is then added to the query. The OR means that a note matches this second part of the query if any one or more of the 3 attributes has an empty value. So it only takes any nee of the three attributes to be wrong for the note to match the query.
You can use either approach. Depending on the task, the best fit may differ. For instance if the edits to the 3 attributes are different in nature it may make sense to work though just one at at time, and so on. Either way, there is a solution for you.
Does that help?