Keeping a updated dynamic list of my 15 most recently modified notes?

Hi Everyone,

I would like to keep a dynamic list of my 15 most recently modified notes I have recently been working on in the document. Ideally, this would be a list in the text of a note.

I realize I could easily sort in the attribute browser by $Modified, however I would like to keep a note at the top of a document to easily see my most recent work especially since I tend to use many different .tbx documents.

Thanks in advance,
Tom

Perhaps this could help get you started.

Agent.tbx (123.9 KB)

I don’t have time right now to do anything better, but I will try once I get the chance.

Thanks Bernard-o. This is a start. I am worried about going down the path of agents because over time, I already use a lot of agents and depending how large the documents get, I want to avoid sluggishness. Therefore, I was hoping to use an edict with a collect_if operator. Just to get a list that I could see in $Text.

For me, this recently used list can be applied to not only my recent notes, but also recent $Tags, but for now just getting a list of my top 10-15 notes would be helpful.

My issue, with using collect_if or collect or find(), besides my inexperience with using them is how do I limit the result to the top 10 or 15. I do not see where there is an option to specify how many values you want. Sort of stuck here.

Here is a wonderful thread from the past that hints at this: Common Tasks: How can I be sure this note will show up later when it's valuable? - #4 by dberreby

In there you will see a wonderful quote from MarkB…

A recently used list is my initial stab at “informational gardening”. Something I have tried in the past, but have not been very good at over time. At least by revisiting recent notes, I can somewhat understand what my context was when I last opened the document. For some it might be days, but others it might be weeks to months. I think of these notes as contextual breadcrumbs.

Thanks
Tom

For a stamp or edict approach (same code, just more or less control over how often it runs) you can:

  • find() all notes with a $Modified value .
  • sort on $Modified, reversed, i.e. most recent first.
  • pass to a String, via .format('\n").
  • this allows us to ask for .paragraphs(15). This is needed as you can’t use List.at() to get a range of list items.

Another approach would be

  • find() all notes with a $Modified value.
  • loop using List.each(), with a loop variable.
  • for loop items 1-15 concatenate the notes to $Text with a line break after each item.

Note: find() returns paths. do you want the $Path or the $Name of your ‘recent’ note in the text.

Hopefully this helps. If not enough detail to code for yourself just ask.

†. This really collects too many items. If you can you should add extra query parameters to limit the number of items in the scope of the search. A trival example is you don’t want to search prototypes and templates, so if all you main data in under one container (e.g. ‘DATA’), start with a scope restricting query term like descendedFrom("DATA").

‡. You likely want to exclude notes like the one listing recent items from the search as it will have been modified recently!

1 Like

Thank you Mark, the part where I have been getting stuck is finding out how to just limit the list to 10 or 15 items. I am hitting the edges of my Tinderbox scripting experience with this example but that is a good thing. :slight_smile:

I will study your 2 suggestions and see what I come up with this week.

Thank You as always my friend,
Tom

I’d use two agents.

  1. Agent 1: Find all the pertinent items, and sort them by $Modified.
    1.Agent 2: Find the first 10 items insider Agent 1.

Thanks Mark,
How do you find the first 10 items in Agent1?

Tom

@eastgate, I think this should work, but it is not. I created the first agent and sorted it by $Modified. In the second agent, I search the first agent for $SiblingOrder<=5. I would think that this should give me the first five siblings, but I’m getting more. What am I doing wrong?

Also, I’m getting a strange UI.
FindLastModified.tbx (121.3 KB)

@satikusala: you want $SiblingOrder(original)<5 .

@TomD: AgentQuery: first(/path/to/Agent1,10)

Actually, I don’t think so. I don’t want the original notes, but rather the aliases in the first agent. If I did original that would not drive the desired result as original may not be sorted by $Modified.

Did not know about the first method. Very cool, works perfectly. Tom, see attached.

Sill need to understand how I can interrogate the sibling order of the aliases, not the originals.

FindLastModified.tbx (125.2 KB)

I don’t think you can. this is bound to the alias proposed for the agent. original is bound to the original.

Ah…yes…I see the sibling order is related to the actual original notes, not the results of the search. Makes sense. Anyway, the “first()” method is SOOOOO much cleaner. :slight_smile:

Many thanks MarkB and Michael. Like many things Tinderbox, I had not known or ever before used the first() operator or known about $SiblingOrder because I had not needed them before. I feel I have been learning so much in the past few months especially, by pushing my boundaries and working through these issues in the forum. Understanding is sometimes much more deliberate than we would like, however it is broadening my abilities to use tinderbox. Thank you.

Will begin implementing first() with my notes, tags and keywords to drive better contextual understanding especially when I revisit my notes.

I am intrigued about simulating your dashboards as “To resurface notes” described here. image

Thank you both. I think I am good for now. Have a great week.
Tom

2 Likes

Great quote!!!