Alarm Daemon to trigger daily actions

Hi,

i am trying to use the Tiddly time tools to have a running daemon to catch Tiddlers meeting a specific condition and take actions against them .

I have managed to put togther with my limited knowledge( and with help with syntax correction from a very recent forum post ) to do this

<$let outcome={{{ [<now YYYY0MM0DD0hh0mm0ss0XXX>compare:date:gt{!!endd}then[yes]else[no]] }}}>
<br><$list filter="[<outcome>match[yes]]">
<$action-setfield  $tiddler ="testiddler" $field = "status"  $value ="overdue"/>
</$list>

this if put in a Tiddler i call Breach , i can run a daily alarm called Breach, that can go every day check if << now >> is greater than a due date value in in a custom date field , if it is , it creates a new tiddler called test tiddler , and sets the “status” field value to “overdue”

2 problems.

first problem . so i actually first used << currentTiddler >> and not " testiddler" as this is obviously the tiddler i would want to change its status to “overdue” , but it doesnt work … instead it goes and creates a new tiddler called “yes” and sets its status field to overdue , when i changed the tiddler to "test tiddler " , it worked and it went and updated “test tiddler” , so why does << currentTiddler >> does not work in the context of the code above

second , i was actually hoping once i get this sorted , to have the alarm actions go against multiple tiddlers and not just one , so basically the argument would be , if any tiddlers are Tagged with X , AND << now >> is greater that the date value in their “endd” field , then they would automatically have their “status” field changed to “overdue”
is this achievable ?

Your $action-setfield occurs within a $list widget that, by default, sets the value of <<currentTiddler>> based on the result of the $list filter. Since your list filter is “[<outcome>match[yes]]”, the value of <<currentTiddler>> is set to “yes”. To avoid this situation, you can use the variable="..." syntax in the $list widget to prevent the value of <<currentTiddler>> from being changed, like this:

<$list filter="[<outcome>match[yes]]" variable="junk">
<$action-setfield status="overdue"/>
</$list>

Also note that $action-setfield has an alternative syntax for setting field values that doesn’t need to use the more verbose $field="status" and $value="overdue" params. Instead, just use status="overdue".

Try this:

Create a tiddler (e.g., “CheckOverdueStatus”), tagged with $:/tags/StartupAction/Browser containing:

<$list filter="[tag[X]has[endd]] :filter[<now YYYY0MM0DD>compare:date:gt{!!endd}]">
   <$action-setfield status="overdue"/>
</$list>

Note that this tiddler defines a simple “StartupAction” that is triggered each time you open your document, and doesn’t actually use any of my TiddlyTools Time functions to create an interrupt-driven “running daemon”.

Instead, the $:/tags/StartupAction/Browser tag causes the code contained in the CheckOverdueStatus tiddler to be automatically invoked “at startup”. This code finds all tiddlers tagged with “X” that also have a non-blank endd field and filters to get only the tiddlers for which the current local datetime value is greater than the endd field value so it can then set the status field in each of those tiddlers to “overdue”.

Also note that, because you are using compare:date:gt{!!endd}, you don’t need to use the full YYYY0MM0DD0hh0mm0ss0XXX datetime format in the filter, or in the stored endd field values, which can just be values like “20230211”.

Q.E.D.

Let me know how it goes…

enjoy,
-e

1 Like

I waited for @EricShulman to give a full and comprehensive answer but a simple approach I use, is a tiddler in the default tiddlers, that comes up when you load the wiki containing a simple List of items for today.

  • As I do them they are removed from the list
  • Things past due are also highlighted
  • Projectify does this automatically
1 Like

@EricShulman worked , both for startup and using the alarm to actually set the fields , thank you very much :slight_smile: i prefer the alarm method as i can have my wiki open for days sometimes, plus ,although i have nothing in mind now , but i believe this method would provide more utlitiy for other purposes , offcourse as long as i dont go crazy with it and make the alarm choke on a thousand tiddlers or something :slight_smile:

@TW_Tones thanks a lot tones, yes i believe projectify does that too , its just , i am pretty keen to have a field holding the overdue value as opposed to displaying it through a filter , i guess i might be looking at it from a different prespective( perhaps the wrong one :/) but it just makes more sense to me to have a field holding a value that can easily be manipulated if needed , am i looking at this wrong ?

Right or wrong is in the eye of the beholder. The idea that a tiddler must have its status set, rather than simply determined on the fly, is in my view more complex and more likely to break, it also consumes more bytes and demands you keep track of the method you used in case it needs repair.

  • But if you have it working stay with it