Tinderbox Forum

Have container track the modified date of children

I have a container with many children notes. Over time these notes are modified, changed, deleted etc… I would like to track the dates of the most recent modification at the level of the container e.g. via a Container level attribute. If then have many container in my view (and I often do) I can then spot the container with the most recent changes inside.

If I’ve understood correctly the attribute $Modified for the container only tracks changes to that note and is not triggered by changes in the underlying notes within the container. It’s not clear to me what edict or stamp rule would allow me to retrieve the most recent change.

I believe you want a rule on the container, something like:

$MyDate=collect(children,$Modified).max

You say that you have many children notes. If we’re looking at thousands of notes, this might involve a lot of work. If you can tolerate the result being a bit out-of-date, you might replace the rule with an edict. But I’d start with a rule, and defer optimization until things do turn out to be a problem.

Thanks. I’ve managed to avoid using collect() mostly due to my lack of understanding of what to do with the results. I also didn’t know that .max could be applied to dates so alround a good rule to learn something new.

Hey Malcolm, BTW, I just did a video on this exact topic: Tinderbox Training Video 27 - TBX - Deconstructing Daily Journal Date Descendants Management.

Much appreciated @satikusala. I’ve learned a lot watching your other videos and will check out your latest magnum opus. A personal thanks for your efforts and contribution to the TB community.

2 Likes

Is there are way of doing this without storing in the attribute $MyDate e.g. by chaining together. This for instance does NOT work

$Subtitle="Most Recent note: "+ $collect(children,$MyDate).max.format("l");

Probably a syntax issue.

Omit the “$” before collect. That’ll work!

Silly me - thanks.