brackets drop out when $setting a variable to the result of a filter

52 views
Skip to first unread message

Michael Gentry

unread,
Sep 26, 2019, 1:48:56 PM9/26/19
to TiddlyWiki
I have a tiddler called Ghostbusters. It has a field, "actors," containing the following title list: [[Bill Murray]] [[Harold Ramis]] [[Dan Ackroyd]] [[Ernie Hudson]]

Now, if I do this:

<$list filter="[[Ghostbusters]get[actors]]" />

the result is [[Bill Murray]] [[Harold Ramis]] [[Dan Ackroyd]] [[Ernie Hudson]] (linked as though it's one long title for a single tiddler, but that's okay for now).

However, if I do this:

<$set name="actorList" filter="[[Ghostbusters]get[actors]]" >

<<actorList>>

</$set>

the result is [[Bill Murray Harold Ramis Dan Ackroyd Ernie Hudson]]. Where did the rest of the brackets go?

Mark S.

unread,
Sep 26, 2019, 1:55:36 PM9/26/19
to TiddlyWiki
As in the other thread, you can now use the each:list-item filter operator syntax:

<$list filter="[[Ghostbusters]each:list-item[actors]]" />

coda coder

unread,
Sep 26, 2019, 1:56:18 PM9/26/19
to TiddlyWiki
Try...

<$set name="actorList" filter="[[Ghostbusters]get[actors]!enlist[]]" >


This works at tiddlwiki.com:

[tag[Filter Operators]!enlist[]]


TonyM

unread,
Sep 26, 2019, 5:38:39 PM9/26/19
to TiddlyWiki
FYI

In both cases you are asking to get the content of the field. In the list it returns a list of titles, remember it processes one at a time and warps each as a title..
It does look a little odd but when you get the fieldname in the set it sets the value to everything in the field (And wraps it as a title).
As soon as you start to deal with fields that contain more than one title you need to change the way you refer to them so as to treat the field as containing titles eg the recommended use of each, or the Listops Operators

This difference between what the field contains and its components when titles are extracted is a helpful lesson in using tiddlywiki.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages