Tinderbox Forum

Display a date in the note's title?

Hi, there!

I am currently using Tinderbox to manage some large creative projects for myself.

One of these projects has several containers organized by what I need to research and do. As I work on my notes, I need to make some of them into tasks. I drag notes out of their original containers into my “Next-up Tasks” container which has the AddAction of turning the note light red and setting the start date to today, the current date on which I put the note into the container. In the inspector I have entered:

$Color=#D182A0;$StartDate=“today”;

which works great. The note changes color and I can easily see the correct position of the note in timeline view.

But when I put my notes in the container, I also want the StartDate to show in the title of the note so I can see it. It would be nice not to have to manually type in the start date on each note added.

I have searched the manual, online help, this forum and have read the Tinderbox Way, but really am not seeing or figuring how to do this.

Any ideas anybody? :slight_smile:

Arielle

If I’ve understood your situation correctly I think $DisplayExpression will achieve what you are looking for. Using a prototype, set its $DisplayExpression to a string incorporating $StartDate

Thanks Rob. :slight_smile:

So this is the note I start with:

screen4

This is the note I want to end up with – or something along these lines:

screen5

But when I put this into the Inspector:

This is what I end up with.

What am I doing wrong?

Arielle

Your error is the DisplayExpression code. you want it to be the title ($Name) plus the $StartDate, but you’ve coded it to be just the StartDate. Try:

$DisplayExpression=$Name+" "+$StartDate;

Better yet, go to the Title tab in the Inspector for the prototype note. There’s a text field for the display expression. Enter

$Name+" "+$StartDate;

2 Likes

Gasp! That worked like magic!

Thank you Mark and Mark! Now I see what I was missing. :smile:

hi, sorry to reopen an old conversation but it seemed better than starting a new one: I am trying to have a note display the startdate (or another date attribute) in the l or L format, followed by the Name, but don’t seem to be able to crack it. I am sure it’s simple, but the one above only throws up a full date+time (and I haven’t managed to figure out how to swap the attributes so the date comes first. Could you help? Thanks!

Assuming you want a Display Expression:

$DisplayExpression=$StartDate.format("l")+" "+$Name;

This leaves $Name untouched. So note “Project X” retains that $Name but the visible title ($DisplayName) becomes 14/08/2020 Project X. The latter is as on my UK (dd/mm/yyyy) OS - other locales may show the date differently. The character(s) in quotes in the .format() above set the date format - see date format designators.

The example above is to set a Display Expression via code. The result, or if typed into the Title Inspector manually is like this:

Does that help?

That’s the one, many thanks @mwra.

1 Like

Mark @mwra, apologies, still having an oddity with this. It works fine, but I get an error message, which it would be nice to get to the bottom of.

My
$StartDate.format(“y-M0-D”)+" "+$Name;
comes out fine, but the error message reports back:
image

I’m sure it’s something simple I’m missing, but it’d be nice to know what!

Many thanks in advance.

I think you have some curly quotes in that expression.

Try

$StartDate.format("y-M0-D")+" "+$Name;

[sorry - cross-posted on top of @PaulWalters’ solution, but our suggestion is the same!]

The forum software turns straight quotes into curly ones. Can you confirm that unlike your code as posted, i.e. …

$StartDate.format(“y-M0-D”)+" "+$Name;

Your code is actually:

$StartDate.format("y-M0-D")+" "+$Name;

The first will fail as curly quotes aren’t treated as string delimiters by action code. Anyway, if we can confirm this isn’t the issue before looking further.

. To make code samples render as monospace & without quote style auto-correction do any one of:

  • Select the code and click the </> button in the toolbar for the message drafting box.
  • Put a single back-tick ` symbol immediately before and after the code sample.
  • For multi-line sample or where you’d like a form of syntac colouring, put a series of three back-ticks ( ``` ) on a line of their own both before and after your code sample (this is the method I’ve use above here in this post)

Many thanks, @mrwa Mark and @PaulWalters, that seems to have done the trick.

1 Like