[TW5] Can the MakeTid Widget be used to create tiddlers from a list in conjunction with a tiddler template

222 views
Skip to first unread message

J Mc

unread,
Feb 2, 2017, 7:20:38 AM2/2/17
to TiddlyWiki
I can create multiple new tiddlers from a list in a tiddler called "ListOfTitles" by using a button.

<$button>
make new tiddlers from list
<$list filter={{ListOfTitles}}>
<$action-setfield $tiddler={{!!title}} text=""/>
</$list>
</$button>

Tiddler ListOfTitles
first
second
third

Can I use the MakeTid widget (http://gwiz.tiddlyspot.com/#:MakeTidWidget%20sample-template) in conjunction with this code to create a series of tiddlers based on a defined template with a number of fields.

Any help you could offer would be much appreciated.

My understanding is that the setfield action can only use a pure list and not include the field contents of a template tiddler.

I need to create a large number of tiddlers (each with the same fields) which would take forever to create using newhere or cloning.

Thanks.



Tobias Beer

unread,
Feb 2, 2017, 7:31:25 AM2/2/17
to tiddl...@googlegroups.com
Hi J,

As far as I can see, it cannot, since it provides
the button itself rather act like other ActionWidgets.

However, you can use tobibeer/make and tobibeer/split
alongside the WidgetMessage: tm-new-tiddler like so:

<$set name="titleFoo" filter="[[foo]make[%title% %date% \ date-format:YYYY-0MM-0DD]split[ ]]">
<$set name="titleBar" filter="[[bar]make[%title% %date% \ date-format:0hh:0mm:0ss]split[ ]]">
<$button>
<$action-sendmessage $message="tm-new-tiddler" title=<
<titleFoo>> tags="Foo" text=<<now "Today is DDth, MMM YYYY">>/>
<$action-sendmessage $message="tm-new-tiddler" title=<
<titleBar>> tags="Bar" text=<<now "Today is DDth, MMM YYYY">>/>
Create two tiddlers in edit-mode
</$button>
</$set>
</$set>

Alternatively, you can use the ActionSetFieldWidget instead,
to create the tiddlers silently, w/o EditMode:

<$set name="titleFoo" filter="[[foo]make[%title% %date% \ date-format:YYYY-0MM-0DD]split[ ]]">
<$set name="titleBar" filter="[[bar]make[%title% %date% \ date-format:0hh:0mm:0ss]split[ ]]">
<$button>
<$action-setfield $tiddler=<<titleFoo>>
text=<<now "Today is DDth, MMM YYYY">>
tags="Foo"/>
<$action-setfield $tiddler=<<titleBar>>
text=<<now "Today is DDth, MMM YYYY">>
tags="Bar"/>
<$action-navigate $to=<<titleBar>>/>
<$action-navigate $to=<<titleFoo>>/>
Create two tiddlers silently and open them
</$button>
</$set>
</$set>

You can try the above examples directly at:

http://tobibeer.github.io/tw5-plugins

Best wishes,

Tobias.

J Mc

unread,
Feb 2, 2017, 1:06:36 PM2/2/17
to TiddlyWiki

Tobias, thanks for your very quick reponse.

I am not sure how your examples call up a tiddler containing the list of tiddler titles which I need to split, but I will look through your examples and documentation.
After further reading, I'm sure it will be made clear.

Best wishes,

J Mc

Tobias Beer

unread,
Feb 2, 2017, 4:05:36 PM2/2/17
to TiddlyWiki
Hi J,

Now that I read your first post again,
I think I totally overengineered my first answer
considering what I now believe you are after.

So, let's roll back to the simple questions:
Best wishes,

Tobias. 

Mat

unread,
Feb 3, 2017, 4:43:56 AM2/3/17
to tiddl...@googlegroups.com
[ Post was mutilated by google so critical parts were missing. I'm deleting this instead. ]

Tobias Beer

unread,
Feb 3, 2017, 6:30:52 AM2/3/17
to TiddlyWiki
Hi Mat,

Why can I not use this template:

Can you please provide a full example of what you tried?
...and explain the part, precisely, that doesn't work?

To set the text using the ActionSetFieldWidget, you do:

<$action-setfield $tiddler="foo" text={{some-text-reference}}/>

If you want to use the wikified results, you use the WikifyWidget:

<$vars currentTiddler="foo">
<$wikify name="text" text={{some-text-reference}}>
<$button>
Create foo
<$action-setfield text=<
<text>>/>
<$action-navigate/>
</$button>
</$wikify>
</$vars>

Where as:

title: some-text-reference

@@background-color:yellow;
Hello, my title is {{!!title}}
@@

Best wishes,

Tobias.

cmari

unread,
Feb 3, 2017, 10:42:04 AM2/3/17
to TiddlyWiki
It should work with single quotes around the text? As in:
<$button>
make new tiddlers from list
<$list filter={{ListOfTitles}}>
<$action-setfield $tiddler={{!!title}} text='{{||A}}'/>
</$list>
</$button>

cmari

On Friday, February 3, 2017 at 1:43:56 AM UTC-8, Mat wrote:
(unknown reason why formtting messes below, sorry)

 
I agree with J Mc's original question.


Why can I not use this template:

title:A
text
:

@@background-color:yellow;
Hello, my title is {{!!title}}
@@


And then another tiddler with the button:

{{||A}}

The tags are applied. The text is not. It does not help if one uses "text=<<someSetValue>>" either. I cannot see how that makes sense.

<:-)

J Mc

unread,
Feb 3, 2017, 2:10:25 PM2/3/17
to TiddlyWiki
Hello Tobias, Mat and cmari, sorry for my delay in replying.

My original requirements were:

1) create a tiddler with a number of fields, some tags and several titles of a required list of tiddlers (ListOfTitles)

2) Use the MakeTid or other widget to read each of the titles and number of fields in the ListOfTitles tiddler, then create the resultant individual tiddlers.

The problem seems to be how can the ListOfTitles tiddler be used to create the required tiddlers.

The MakeTid widget and others can be used to make multiple tiddlers in a sequence or with one title but not the named tiddler titles defined in the ListOfTitles tiddler.

Eg.
ListOfTitles tiddler includes a number of tiddler names.

These could be,
Name A
Name B
Name C
Etc.

The created tiddlers should be Name A, Name B, Name C all with tags and fields as defined in the ListOfTitles tiddler.

I hope this is clearer than my original post.

J Mc

Tobias Beer

unread,
Feb 3, 2017, 3:20:54 PM2/3/17
to TiddlyWiki
Hi J,

Still not getting what isn't working for you.

What's not working about my initial suggestion(s)?

Are you saying you want to make an exact duplicate of ListOfTitles,
except for the text field since that contains the titles?
In other words: you don't want to have to be specific about the fields?

If that is so, why does ListOfTitles have to be both the template as well as the list?

You can just define the right fields and values using action-setfield.
You do not need any template tiddler.
Do you have a hard requirement that it must be a template tiddler?

Best wishes,

Tobias.

J Mc

unread,
Feb 3, 2017, 3:29:19 PM2/3/17
to TiddlyWiki
Hi Tobias,
my main problem is the list of titles.
If I can define the fields and tags elsewhere, then the ListOfTitles tiddler would be just that - a list of names for each tiddlers title.
I want to create families of items such as parts, materials, ingredients etc by making a list of titles for each.
I can then edit each tiddler's fields and text as necessary.

Sorry for the confusion'

Tobias Beer

unread,
Feb 3, 2017, 3:56:47 PM2/3/17
to TiddlyWiki
Hi J,
 
Sorry for the confusion'

Can you specifically say what is not working for you?
Because, when I try your example, it work's for me,
w/o needing any ActionMakeTid.

Simply define the fields you wish to set
using action.setfield and you're done.

Best wishes,

Tobias.

Tobias Beer

unread,
Feb 3, 2017, 4:01:35 PM2/3/17
to tiddl...@googlegroups.com
Hi J,
 
Simply define the fields you wish to set
using action.setfield and you're done.

What I mean is something like...

<$tiddler tiddler="ListOfTitles">

<$button>
make new tiddlers from list
<$list filter={{ListOfTitles}} variable="title">
<$action-setfield
    $tiddler=<
<title>>
    text="some text"
    tags={{!!tags}}
    foo={{!!foo}}
    mumble={{!!mumble}}/>
</$list>
</$button>
</$tiddler>

and then...

title: ListOfTitles
foo
: bar baz
tags
: ah ja
mumble
: [[frotz gronk]]

first
second
third

Best wishes,

Tobias.

J Mc

unread,
Feb 3, 2017, 4:09:03 PM2/3/17
to TiddlyWiki
Hi Tobias,
I new the original list was working, but if I added fields etc it didn't.
Like you say, if I define the fields using action setfield rather than trying to do it via a template, it should work.
I'll try your suggestion and get back to you when it works.
Sorry again for any confusion caused and for wasting your time.
Thanks,
J Mc

Matabele

unread,
Feb 3, 2017, 7:31:16 PM2/3/17
to TiddlyWiki
Hi J Mc and Tobias

I can give a kind of general answer.

The ActionSetfield widget may be used by way of a hack to create new tiddlers silently in the background, since setting the value of a field of a non-existent tiddler currently results in the missing tiddler being created quietly in the background. However, this did not fit all of my requirements, hence the ActionMaketid widget -- some quick notes:
-- There is no option to open the list of new tiddlers in the story river nor open the list of tiddlers for editing (or indeed, with two ActionMaketid widgets, some mix of the three scenarios).
-- The ActionMaketid widget came derived from a line of widgets whose purpose was the creation of multipurpose buttons
-- The ActionMaketid widget requires a list of titles as input (and can create simple series of tiddlers, such as indexed with an integer on its own)
-- I cut down one of Tobias widgets to be used for more complex cases
-- There may be cases where the ActionSetfield method is either sufficient or superior to the MakeTid method
-- I began be using the ActionSetfield (actually my old SetField widget) method to create tiddlers by default and wrote the ActionMaketid to do some things impossible with the ActionSetfield method
-- nowadays I tend to try the ActionMaketid first (its made for the purpose)

regards

Matabele

unread,
Feb 3, 2017, 7:35:31 PM2/3/17
to TiddlyWiki
Hi r

As far as I remember, the ActionSetfield widget may also be used in conjunction with a widget message to open the new tiddlers for editing.

regards

Tobias Beer

unread,
Feb 4, 2017, 4:18:53 AM2/4/17
to TiddlyWiki
Hi again J,

So, am I assumging right that you try to achieve both these things:
  1. a list of (possibly generated) titles based on which to generate tiddlers
  2. a (dynamic) template the properties / fields of which you do not want hard-coded via action-setfield but rather "copy" from that template
Something like that?

Best wishes,

Tobias.

J Mc

unread,
Feb 4, 2017, 7:20:55 AM2/4/17
to TiddlyWiki
Hello again Tobias,
You are assuming right, that's exactly what I need.

Best wishes,

J Mc

J Mc

unread,
Feb 4, 2017, 9:22:05 AM2/4/17
to TiddlyWiki
Thanks Tobias,
this works for me too.

J Mc
Reply all
Reply to author
Forward
0 new messages