Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Questions and Answers >> Unique Identifier in Note Title
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1467054550

Message started by wajakob on Jun 27th, 2016, 3:09pm

Title: Unique Identifier in Note Title
Post by wajakob on Jun 27th, 2016, 3:09pm

I am working on using a Tinderbox file as a Zettelkasten.  For this I need to have a unique identifier for each note.  Is there anyway to auto insert date and time in the note title?

Title: Re: Unique Identifier in Note Title
Post by Mark Anderson on Jun 27th, 2016, 3:30pm

Yes, you can use a rule (or edict if you want itto run less often) in the note, an on add action in the parent container or use an agents's action.

This action code appends the date to the front of a note $Name:

$Name = date("now").format("y-M0-D h:mm") + " " + $Name

If your note is called "Brexit nightmare" and the date time is currently 27/6/16 20:22, then the above action would reset the note name to "2016-06-27 20:22 Brexit nightmare".

You'll also want to consider how you want to stop the code running more than once, but the above gives you the basic parts of the solution.

Title: Re: Unique Identifier in Note Title
Post by Mark Bernstein on Jun 27th, 2016, 4:22pm

Alternatively, you might create a sequential numerical attribute -- perhaps named IndexNumber, which will be distinct for each note.  You could then use a DisplayExpression

     $Name+": "+$IndexNumber

And have notes appear like

    Theodore Roosevelt:132
    Living room renovation idea: 133
    Pick up bagels: 134
    Eugene Debs: 135

Title: Re: Unique Identifier in Note Title
Post by wajakob on Jun 27th, 2016, 5:57pm

Many thanks.

Title: Re: Unique Identifier in Note Title
Post by Derek Van Ittersum on Jun 28th, 2016, 7:01am

I had the same thought as you--creating the unique identifier based on the name. But then I remembered that each note already has its creation date associated as an attribute. Within Tinderbox, it's not that necessary to add it to the name, in my mind. So, I created a display expression to show the date along with the name. Then I decided that was too cluttered and left the unique identifier as a hover expression instead.

Then, if I ever decide to export the notes from Tinderbox, I can still use that unique identifier (essentially just the date/time as a numerical string). Via export code, I could export each note with a file name consisting of the unique identifier and the note name.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.