Hallo everybody,
how do I assign a set of tags to ‘tags’ field of a tiddler just about to be created via action-createtiddler widget? I tried to assign it by putting a filter as right member of the = assignment symbol as in
<$button>
<action-createtiddler
...
tags={{{[[my]<fancy-filter>here[]]}}}
/>
</$button>
but the outcome of the above assignment is that ‘tags’ parameter only swallows in the first item output by the filter’s run.
I also tried with a variable, as in
<$set name="myTags" filter="[[my]<fancy-filter>here[]]">
<$button>
<action-createtiddler
...
tags=<<myTags>>
/>
</$button>
</$set>
but with no more success: as before, ‘tags’ doesn’t take the whole set of items output by the filter, only the first of them.
I will come over the topic again later, and elaborate a broader discussion and pose more general, more theoretical questions, but for the time being I need a quick hint on how to do the assignment.
Thanks and regards,
CG
A filtered transclusion only returns the first result from evaluating the filter, so you need to return a single string in title list format:
tags={{{ [<my-fancy-filter-here>format:titlelist[]join[ ]] }}}
If appropriate you can use tags={{!!tags}} to pass on the current tiddlers tags. This is a parameter in the
$action-createtiddler opening eg before its “>”
Also once you have created the tiddler you can use other action widgets ( createTiddler-title) inside the $action-createtiddler or still within the same trigger/button, such as ActionSendMessageWidget with the tm-add-tag message, an ActionListopsWidget to manipulate lists like a tag field, or ActionSetFieldWidget for single or prepared values.
There are so many ways to do it.
Just google search across here. Thanks for the hint about join[ ].
Here is my button to create new tiddler with a template
\procedure temp-tiddler() $:/state/ego-store-lite/newAction
\function temp-tiddler-draft-title() [<temp-tiddler>get[draft.title]]
<$action-createtiddler
$basetitle=<<temp-tiddler-draft-title>>
$template=<<temp-tiddler>>
tags={{{ [<temp-tiddler>get[tags]enlist-input[]] [[$:/Tags/Gamification/RealityAction]] +[join[ ]] }}}
>
<!-- delete temp tiddler and temp fields -->
<$action-deletetiddler $tiddler=<<temp-tiddler>>/>
<$action-deletefield $tiddler=<<createTiddler-title>> draft.title draft.of/>
<!-- go back to actions tab -->
<$action-setfield $tiddler="$:/state/tabs/ego-store-lite/1" text="$:/plugins/linonetwo/ego-store-lite/tiddlywiki-ui/actions-list/actions-list"/>
</$action-createtiddler>
<<lingo Create/OK>>
</$button>
You will need +[join[ ]] to allow adding multiple tags.