A minor issue that has occasionally tripped me up is the accidental creation of what I can only call “empty parents”.
In the following, it looks as if beta gamma delta
are children of alpha
(and the line before beta is a spacer)
but in fact there are two possibilities, and deleting the blank row may also delete all those descendants.
i.e. we (probably) assume this:
but it might, in fact, be:
in which alpha actually has no children at all, and deleting the blank line would also delete the remaining lines.
Probably a very small issue which doesn’t come up much – I noticed it when a Copy As MD
script sometimes didn’t show the nesting that I expected – and we can write scripts to flag (possibly fix ?) these accidental “empty parents”
Expand disclosure triangle to view JS source
(() => {
"use strict";
const
bike = Application("Bike"),
doc = bike.documents.at(0);
return doc.exists()
? (() => {
const
allRows = doc.rows,
emptyParents = allRows.where({
name: "",
containsRows: true
}),
n = emptyParents.length;
return (
emptyParents().forEach(
x => x.name = "<empty parent>"
),
`${n} empty parents found and flagged.`
);
})()
: "No document open in Bike.";
})();
but I wonder if there is another approach ? Making them visible even when the cursor isn’t on that empty line, perhaps ?