TW,
Thank you for your 1000-foot view of my problem, and you are exactly right.
In my defense, this is something I've been tweaking for a number of years,
changing it and improving it when my job needs changed, and learning TW as
I went. It is overdue for being refactored now that I know more ... but I
haven't wanted to spend the time. But it'll get done.
Also, the tidder titles have all that information so that a (relatively
simple) filtered list would alphabetize well, as that was the first way I
learned for how to get a list of what I wanted. I've been putting the
information into tags, and later into fields, but during my initial design
I didn't know when to use tags vs. fields, or how to use fields, and I'm
still not sure how to filter with fields (but I assume it is possible).
Thanks again!
My best,
Mark
On Friday, July 31, 2020 at 7:48:58 PM UTC-4, TW Tones wrote:
>
> 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/02042297-d9bd-4041-bb5e-3f39a8cf43a0o%40googlegroups.com.