What I’m trying to do
How to establish a sense of sequence among my notes.
Each of my notes have these properties
- previous
- order
If A and B are notes, and
if B.previous = A, then B.order = A.order + 1
if B.previous is empty, then B.order = 1
If I have a long sequence of notes
A(previous = “”, order = 1),
B(previous = [[A]], order = 2)
…
Z(previous = [[Y]], order = 26)
And if I insert a new note, let’s say, between E and F, and update the “previous” property of the relevant notes manually, I want the order property of everything from the new note to the last note, Z in this case, to update automatically
Is there a way?
Things I have tried
I tried with Metadata Menu. I added a new audto-update formula field “order” with this formula -
current["previous"] ? Math.max.apply(null, current["previous"].map(a=>dv.page(a.path)).map(a=>a["order"]).filter(a=>typeof(a)=="number")) + 1 : 1
This seems to work sometimes, but not always. The little icon at the bottom status bar shows Metadata Menu is indexing, which I’m guessing means, it’s going through the files and updating the fields. It keeps on flickering between check-mark icon and refresh icon.
I have about 50 notes and I will be adding more as I use Obsidian
How am I updating the “previous” property of each note? - I have another field in Metadata Menu that gets updated based on edges on a canvas
Is my formula correct?
Is there a better way to accomplish this?