Setting a date attribute automatically

(Mariano Iannuzzi) #1

Hello, fellow TBXers,

I am trying to create a daily activity log in Tinderbox. I created a container where I store notes describing daily achievements.

I also added a User date attribute called $CompletionDate. I would like to have $CompletionDate set to “today” unless I manually specified a date.

I tried the following Rule:


However, the date is set to “never” rather than “today.”

Anyway, your help is most welcome.



(Mark Anderson) #2

Is the ‘If’ above a typo? Action code is case sensitive. If I change ‘If’ to ‘if’ your code works for me. Slightly better usage - so as to get into good habits and not get bitten in more complex code - is to use date() when setting dates, even when using date designators. Thus:


(Mariano Iannuzzi) #3

Thank you very much @mwra, bloody autocorrect :slight_smile:

It works! I did spend, nonetheless, several minutes scratching my head… :grimacing:

Thanks once more.


(Andreas Grimm) #4

@mwra For me this is not working since every minute the $CompletionDate gets updated e.g. it adds another minute to the date.

How can one stamp a CompletionDate that represents the minute of completion and then does not change anymore.

My Rule (!) looks like this:

if($Checked==true){$Badge=ok; $CompletionDate=date("today")} else {$Badge=calendar; $CompletionDate=never};

Can someone help on this?


(Paul Walters) #5

If you want a one-time rule then modify your rule with $Rule=; as follows:

if($Checked==true){$Badge=ok; $CompletionDate=date("today");$Rule=;} else {$Badge=calendar; $CompletionDate=never};

This will wipe out the rule as soon as it runs once.

If you are going to use this in a lot of notes, then maybe consider using an Edict or a low-frequency Agent?

(Mark Anderson) #6

Or, change



See the logical OR operator. This code will run continuously but only set $CompletionDate once. That said, I think @PaulWalters answer above is probably as, if not more, practical.

(Andreas Grimm) #7

Just to the point, Maestro @PaulWalters. It works perfectly well for me. Thank you!

(Andreas Grimm) #8

Thank you @mwra. Works well, too. But just as you said, @PaulWalters’ suggestion might be the way to go in this very setting.