Hi TW-Community,
I struggling with the usage of paramenter from a procedure within action-createtiddler
Situation:
I have this wunderful global procedure to create a tiddler named by parameter and also tagged by the same parameter:
code-body: yes
tags: $:/tags/Global
title: tryout/new_entry
\procedure new-entry(selector, sep)
\procedure new-tiddler()
<$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" separator:"$(sep)$" startCount:"01" template:"$basename$$separator$$count:2$">>`>
<$action-createtiddler $basetitle=<<title>> tags=<<selector>> >
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
</$wikify>
\end new-tiddler
<$button actions=<<new-tiddler>> >
{{$:/core/images/plus-button}} <<selector>>
</$button>
\end
If I call this procedure from a New Tiddler
with <<new-entry "Department" "/">>
and press the button a Tiddler will be generated with title Department/02
and tag Department
.
I have also this procedures to edit fields.
In my use case the generated Tiddler Department/02
with tag Department
will recognized by the ViewTemplate
and the procedure <<edit_fields "Department" "caption Name Location">>
is called.
Also fine, everthing as expected.
As you see I give the user the possibility to generate a new location if there is another Tiddler available with the tag Location
. The button appear. Also fine.
If I now press this Button to generate a new Location what is the same procedure as I am using in the New Tiddler
, the new Tiddler will be generated with title Location/02
but the tag is not Location
as expected it is <<field>>
.
I do not understand why the same procedure is doing the right and in another usage not
The call of <<new-entry [[<<field>>]] "/">>
is generating a Tiddler with title Location/02
what explains that the parameter selector
has the right value Location
but will not be used with tags=<<selector>>
.
tags: $:/tags/ViewTemplate
title: tryout/ViewTemplate
<%if [<currentTiddler>tag[Asset]] %>
<<edit_fields "Asset" "caption Name Department Location">>
<%elseif [<currentTiddler>tag[Department]] %>
<<edit_fields "Department" "caption Name Location">>
<%elseif [<currentTiddler>tag[Location]] %>
<<edit_fields "Location" "caption Name country zip city">>
<% endif %>
code-body: yes
tags: $:/tags/Global
title: tryout/edit_fields
\whitespace trim
\procedure edit_fields(selector, fields)
<$let
config=<<currentTiddler>>
>
Please enter the data for the <<selector>> : {{!!caption}}.<br>
The origin name of this Data set is: <<config>>.<br>
<table>
<$list filter="[enlist<fields>]" variable="field">
<tr>
<th><<field>></th>
<td>
<$select field=<<field>> default=<<field>> >
<option value="">(any)</option>
<$list filter="[tag<selector>sort[caption]get<field>] [tag<field>get[caption]sort[]]+[unique[]]" variable="value">
<option><<value>></option>
</$list>
</$select>
</td>
<td>
<$edit-text tiddler=<<field_of_field>> field=<<field>>/>
</td>
<td>
<$list filter="[tag<field>count[]]" variable="c_of_field">
<%if [<c_of_field>compare:number:gt[0]] %>
<<new-entry [[<<field>>]] "/">>
<% endif %>
</$list>
</td>
</tr>
</$list>
</table>
\end
ANY HELP IS WELCOME
Stefan