How do I programmatically build a string to be used as the title for a new tiddler (
<$button> ...
$message="tm-new-tiddler" ...
title=???)?
I'm trying to use
<$button> to start a new tiddler, but I can't get the title set the way I wish. What I want the new tiddler title to be (for instance) is "
A1234,Risk (2020-07-27 15:00:00): ", where:
* "
A1234": value of storyTiddler's field "projectnumber".
* "
,": literal.
* "
Risk": literal for the purposes of this discussion (would prefer it to be parameterized somehow eventually).
* "
(": literal.
* "
2020-07027 15:00:00": from "
<<now "YYYY-0MM-0DD 0hh:0mm:0ss">>".
* "
): ": literal.
I am currently using (inside
<$button>) '
title=<<now "addProjectNumberHere,Risk (YYYY-0MM-0DD 0hh:0mm:0ss): ">>'. (The "addProjectNumberHere" is just a reminder to me to place the project number into the title whenever I add a new risk.)
It seems that I have to execute the "
now" macro only when the new tiddler is created, else the date/time will be off. But, I can't concatentate anything on the "
title=" line, and attempting to build the "
title=" line with a different macro just passes the macro definition characters to the title (no evaluation).
The button is a tiddler titled "buttonNewRisk". That button is transcluded in a tiddler "listProjectRisks". That list is hosted as a tab of the story tiddler "A1234".
Tiddler text for the button to generate a new Risk tiddler follows:
\define projnum()
<$view tiddler=<<storyTiddler>> field=projectnumber/>
\end
\define taglist()
<<projnum>> risk
\end
\define titlemaker()
<<projnum>>,Risk (<<now "YYYY-0MM-0DD 0hh:0mm:0ss">>): THIS DOESN'T WORK WHEN CALLED AS A MACRO ON THE "title=" LINE BELOW
\end
\define buttonnewrisk()
<$wikify name="newtags" text=<<taglist>> >
<$wikify name="newprojnum" text=<<projnum>> >
<$button>
New project risk entry
<$set name="newtext" value={{creationtemplateRisk}} >
<$action-sendmessage
$message="tm-new-tiddler"
title=<<now "addProjectNumberHere,Risk (YYYY-0MM-0DD 0hh:0mm:0ss): ">>
tags=<<newtags>>
text=<<newtext>>
projectnumber=<<newprojnum>>
/>
</$set>
</$button>
</$wikify>
</$wikify>
\end
Need to document a new project risk? Click this [[button|buttonNewRisk]] and, with this [[template|creationtemplateRisk]], a risk tiddler will be created and tagged with ''risk'' and with ''<<projnum>>'': <<buttonnewrisk>>