Help with action-listops please - add tiddler titles with space to field

104 views
Skip to first unread message

TonyM

unread,
Jan 23, 2019, 8:11:17 PM1/23/19
to TiddlyWiki
Folks,

I am deep in the development of a solution and I can't see how to use action-listops  to add tiddler title with spaces to a field/list such as it uses title delimiters of [[title with spaces]].

I would appreciate some suggestions.

In the following (simplified) macro of action widgets I get the value for selected-tiddler from the content of the tiddler named in the text of $(linkTiddler)$
\define add-link-actions()
<$set name=selected-tiddler value={{$(linkTiddler)$}}>
<$action-listops $tiddler="$(targetTiddler)$" $field="related-tiddlers" $subfilter="+[append<selected-tiddler>]" />
</$set>
\end

This works but does not add the title delimiters where appropriate.

Thanks
Tony

S. S.

unread,
Jan 23, 2019, 11:14:28 PM1/23/19
to TiddlyWiki
Tony,

Does this Google Groups post cover a similar issue? Filter/subfilter syntax and variables

Mark S.

unread,
Jan 23, 2019, 11:55:08 PM1/23/19
to TiddlyWiki
Is the text in $(linkTiddler)$ not already formatted as a link?

If so, "append" will see each word in the title as a linking title, similar to "enlist".

This subfilter will append the text as a link:

$subfilter="[<selected-tiddler>]"

Notice that it drops the "+" and the "append". It worked in my tests.

HTH
-- Mark

LorenzGL

unread,
Aug 17, 2019, 1:46:26 AM8/17/19
to TiddlyWiki
Hello Tony,

I have a similar problem with the selectWidget: when trying to assign the currentTiddler Title to a field it doesn't add delimiters. How did you end up solving your problem?


On Wednesday, January 23, 2019 at 5:11:17 PM UTC-8, TonyM wrote:

TonyM

unread,
Aug 22, 2019, 6:50:15 PM8/22/19
to TiddlyWiki
Folks,

A Followup on where this led me.

The final solution is embedded in more complex field definition and handling macros but I provided two methods. Add/Remove and Picklist. The below examples are direct from my macros and includes a range of support variables to automate the use of the macros but I decided to overshare rather than try and build a minimum example. I hope you can extract some useful mechanisms.

Thanks all for your help, at some stage I will try and publish a more generic solution.

A Select one tiddler and add remove buttons
Add member
\define field-add-member(list-field input-filter sort)
<$set name=list-field value="$list-field$" emptyValue="list">
<!-- Removed -[enlist[$list-field$]] from input-filter value to assist setup -->
<$set name=input-filter value="$input-filter$" emptyValue="[each[$list-field$]get[$list-field$]] -[enlist[$list-field$]]">
<$select tiddler="$:/temp/add-item"><$list filter=<<input-filter>> ><option value=<<currentTiddler>>><$view field='title'/></option></$list></$select>
<$button>
<$action-listops $field=<<list-field>> $subfilter="[{$:/temp/add-item}]"/>
<$action-deletetiddler $tiddler="$:/temp/add-item"/>
Add</$button>
<$set><$set>
\end
remove member
\define field-remove-member(list-field input-filter)
<$set name=list-field value="$list-field$" emptyValue="list">
<$set name=input-filter value="$input-filter$" emptyValue="[enlist{!!$list-field$}sort[]]">
<$select tiddler="$:/temp/remove-item"><$list filter=<<input-filter>> ><option value=<<currentTiddler>>><$view field='title'/></option></$list></$select>
<$button>
<$action-listops $field=<<list-field>> $subfilter="-[{$:/temp/remove-item}]"/>
<$action-deletetiddler $tiddler="$:/temp/remove-item"/>
Remove</$button>
<$set><$set>
\end

A Select Multiple and move left and right macro - I call this the picklist method
This version includes a column for drag and drop re-ordering
\define pick-list-membership-and-order(list-field input-filter input-title table-caption rows)
<$set name=input-title value="$input-title$" emptyValue="Select to add">
<$set name=table-caption value="$table-caption$" emptyValue="Select items for $list-field$">
<$set name=rows value="$rows$" emptyValue="15">
<table>
<caption>//Shift to select a range and ctrl to toggle item//</caption>
<tr>
<th><<input-title>></th>
<th>Items to Include</th>
<th></
th>
<th>Existing</th>
<th>Order (Drag and Drop)</
th>
</tr>
<tr>
<td headers="title" style="vertical-align: top"><$select tiddler="$:/
temp/add-items/$list-field$" multiple size=<<rows>> ><$list filter="$input-filter$ -[enlist[$list-field$]]" ><option value=<<currentTiddler>>><$view field='title'/></option></$list></$select></td>
<td headers="
items" style="vertical-align: top"><$list filter={{$:/temp/add-items/$list-field$}} > <$view field='title'/><br></$list><br>
<$button>
<$action-setfield $tiddler="
$:/temp/add-items/$list-field$" text=""/>
clear
</$button>
</td>
<td headers="
arrows" style="vertical-align: top">
<$button tooltip="
Add selected to existing List">
<$action-listops $field="
$list-field$" $subfilter={{$:/temp/add-items/$list-field$}} />
{{$:/core/images/chevron-right}}
</$button><br>
<$button tooltip="
Remove from existing List">
<$action-listops $field="
$list-field$" $subfilter={{{ [{$:/temp/remove-items}] +[addprefix[-]] }}} />
{{$:/core/images/chevron-left}}
</$button>
</td>
<td headers="
existing" style="vertical-align: top"><$select tiddler="$:/temp/remove-items" multiple size=<<rows>>><$list filter="[enlist{!!$list-field$}sort[]]" ><option value=<<currentTiddler>>><$view field='title'/></option></$list></$select><br>
</td>
<td headers="
order" style="vertical-align: top"><$macrocall $name=list-links-draggable tiddler=<<currentTiddler>> field=<<fieldname>>/></td>
</tr>
</table>
<$set><$set><$set>
\end

Regards
Tony
Reply all
Reply to author
Forward
0 new messages