Mark,

Just a coding opinion here, if you are going to the effort of having your 
own new tiddler button, why not move such values into fields?, and let 
titles be descriptive.

Without putting the argument again, I have a number of times in the forum, 
using compound titles as an organising method is a recipe for later issues. 

There are some rare cases where programaticaly generated titles are needed, 
but even then they should not be compound titles, why embed details inside 
a title when you can maintain that information independently in fields?

Regards
Tony

On Saturday, August 1, 2020 at 5:54:52 AM UTC+10, Mark Hylton wrote:
>
> Using TW5: v5.1.21, but willing to upgrade if needed.
>
> On Friday, July 31, 2020 at 3:41:19 PM UTC-4, 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/d8075f43-472d-477f-a156-e021260fb6cfo%40googlegroups.com.

Reply via email to