Indirect Filter Lists

62 views
Skip to first unread message

Benedikt Aufermann

unread,
Mar 11, 2021, 6:52:52 PM3/11/21
to TiddlyWiki
Hi,
I have the following task
I have Tiddlers taged as Country, City or Company
Every City is also tagged with the country and every Company is also tagged with city where it is located.
Example:
'Germany' tagged as 'Country'
'USA' tagged as 'Country'
'Berlin' tagged as 'City' and 'Germany'
'Munic' tagged as 'City' and 'Germany'
'New York" tagged as 'Country' and 'USA'
'Comp1' tagged as 'Company' and 'Munic'
'Comp2' tagged as 'Company' and 'Berlin
'Comp3' tagged as 'Company' and 'Berlin'
'Comp4' tagged as 'Company' and 'New York'

Now I want a list with all Companies in Germany  
Is there a way to create this with a filter?
like tag[Company]tag[tag[Germany]]

Thanks
Benedikt

Mark S.

unread,
Mar 11, 2021, 10:34:33 PM3/11/21
to TiddlyWiki
This would typically require a technique called recursion. But rather than writing your own from scratch, you can use the kin filter available here.

After you have it installed and loaded, you could use a nested set of list widgets like this:

<$list filter="[tag[Company]]" variable="company">
<$list filter="[kin::from:<company>compare:string:eq[Germany]]">
<<company>><br/>
</$list>
</$list>

to find all companies that are descendants of "Germany".

BTW, when did New York become a country? ;-)

Benedikt Aufermann

unread,
Mar 12, 2021, 5:26:51 AM3/12/21
to TiddlyWiki
Hi Mark,
thats a very powerfull PlugIn, thank you for that.
I waste the whole morning with checking the possibilities :-) :-) :-(

Benedikt

Mohamed Amin

unread,
Mar 12, 2021, 6:23:01 AM3/12/21
to TiddlyWiki
If I understand your use case correctly, the following will work as well

Open a new tiddler and write:
{{{ [all[tiddlers]tag[City]tag[Germany]tagging[]tag[Company]] }}}

tag[City]tag[Germany] : Get ALL Tiddlers that have tagged with "City" AND "Germany"
tagging[] : For Each result "X" in the last step: Get all Tiddlers that tagged with "X" (all tiddlers that tagged with any German Cities)
tag[Company] : For Each result "Y" in the last step: GET only those tiddlers that tagged with "Company" (may be you've other things in that City)

Regards
Reply all
Reply to author
Forward
0 new messages