I've left out here the parts where you're other tiddlers and templates that
I don't have access to. But this should get you started.
<$button> Make it
<$vars tim=<<now "YYYY-0MM-0DD 0hh:0mm:0ss">> newtext="my new text"
newprojnum="7689" >
<$action-sendmessage
$message="tm-new-tiddler"
title={{{ [{!!projectnumber}addsuffix[,Risk
(]addsuffix<tim>addsuffix[)]]
}}}
tags={{{ [{!!projnum}append[ risk]] }}}
text=<<newtext>>
projectnumber=<<newprojnum>>
/>
</$vars>
</$button>
On Friday, July 31, 2020 at 12:41:19 PM UTC-7, Mark Hylton wrote:
>
> 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>>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/28fc87ef-ec4c-4653-80fe-e7288fc7c846o%40googlegroups.com.