Code Patter Wanted - List only items in both lists

81 views
Skip to first unread message

TonyM

unread,
Aug 8, 2019, 12:18:53 AM8/8/19
to TiddlyWiki
Folks,

If anyone can help find the following code pattern I would appreciate it.

  • I have two list fields listing a number of titles, some of which may be the same some not
  • For example in the variables list1 and List2
  • I would like to list only items found in both lists
Any suggestions full or partial greatly appreciated. I will publish the result back here.

Thanks
Tony

Mohammad

unread,
Aug 8, 2019, 1:43:39 AM8/8/19
to TiddlyWiki
Try this in tiddlywiki 5.1.20

<$list filter="[range[1,15,2]]">

<$list filter="[range[3,12,3]match<currentTiddler>]" variable="item">
<<item>>
</$list>
</$list>

It only shows those are present in both list!

Mohammad

TonyM

unread,
Aug 8, 2019, 8:26:02 AM8/8/19
to TiddlyWiki
Mohammad,

Thanks but I should have specified 5.1.19 and the two lists are set of titles.

Thanks Mohammad for responding.

I went for a long walk to the Gym and back, and the method popped in my head. I had actually done it before

It goes something like this wrapped in another list to generate each servicename

<$list filter="[is[current]contains:person-services-list[$servicename$]]" emptyMessage=" "><$text text=<<value>>/></$list>

But the overall problem makes my head hurt because I need to Get a "list name" from one field, obtain a list of services from the "list name" tiddler and compare with the person-services-list field on another tiddler.

Arggggghhhh

Tony

bimlas

unread,
Aug 8, 2019, 10:18:07 AM8/8/19
to TiddlyWiki
Not the best, but at least it works. [a b c] is the first set, [b c d] is the second.

[enlist[a b c]] -[enlist[a b c]!enlist[b c d]]

TonyM

unread,
Aug 8, 2019, 8:01:04 PM8/8/19
to TiddlyWiki
Bimlas

As I read this 
  • the first set/run is listed
  • The second run lists those in the first set but not those in the second set 
  • Then the filter as a whole is the first set but not those "not in the second set"
  • This is a double negative so in effect saying is list the first set but only those in the second set.
I now face the challenges of getting the set names from fields, and converting the set names into the list of members in those sets and passing those into your suggested filter.

Thanks
Tony
Reply all
Reply to author
Forward
0 new messages