Hi TW-Community,
I have implemented the function to edit fields from Tiddlers if they are shown and having specific tags.
Here the tag “Department”:
tags: $:/tags/ViewTemplate
title: tryout/ViewTemplate
<%if [<currentTiddler>tag[Department]] %>
<<edit_fields "Department" "caption Full_name Location">>
<% endif %>
The procedure edit_fields
is this here, what is doing more or less what I want
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_of_tiddler">
<tr>
<th><$text text={{{ [<field_of_tiddler>] }}} /></th>
<td>
<$select tiddler=<<currentTiddler>> field=<<field_of_tiddler>> default=<<field_of_tiddler>> >
<option value="">(any)</option>
<$list filter='[tag<selector>sort[caption]]' variable="field_of_field">
<option><$view tiddler=<<field_of_field>> field=<<field_of_tiddler>>/></option>
</$list>
<$list filter='[tag<field_of_tiddler>sort[caption]]' variable="field_of_field">
<option><$view tiddler=<<field_of_field>> field='caption'/></option>
</$list>
</$select>
</td>
<td>
<$edit-text tiddler=<<field_of_field>> field=<<field_of_tiddler>>/>
</td>
</tr>
</$list>
</table>
</$let>
\end
The selection will be generated with these two $list
commands
<$select tiddler=<<currentTiddler>> field=<<field_of_tiddler>> default=<<field_of_tiddler>> >
<option value="">(any)</option>
<$list filter='[tag<selector>sort[caption]]' variable="field_of_field">
<option><$view tiddler=<<field_of_field>> field=<<field_of_tiddler>>/></option>
</$list>
<$list filter='[tag<field_of_tiddler>sort[caption]]' variable="field_of_field">
<option><$view tiddler=<<field_of_field>> field='caption'/></option>
</$list>
</$select>
My problem is, that in some cases I have the same entries in the fields. And than the same wording also in the selection field.
My question is:
Can I avoid these double entries in the $select command?
I thought about to save the list results to a separate cache variable as list and to use this cache variable list to fill the selection with the enlist operator but I am not familiar in generating such a list especially if elements can have spaces in there.
Other ideas are also welcome.
Stefan