Cascading list-operations

85 views
Skip to first unread message

Mirko Richter

unread,
Sep 5, 2019, 2:55:39 PM9/5/19
to TiddlyWiki
Hi,

during my work with TW5 i realize that there is a very common case, where i use a first <$list> to find some information and than use a second <$list> to find all tiddlers kinda relating to that previously found "information".

f.e. find the id of a given tiddler like so:
[<myTiddler>get[id]]

and then look for all the tiddlers that referre to that id, like so:

[ref<previouslyFoundId>]

From my opinion the main problem is the "shift" of the data from the output into the parameter-role which contradicts the standard filter-flow (from my understanding the subfilter doesn't help here).

Is it somehow possible to perform those two steps using just ONE single <$list> element? 

Thanks,
Mirko

TonyM

unread,
Sep 5, 2019, 8:54:10 PM9/5/19
to TiddlyWiki
Mirko

There are case when you must use nested list statements and cant combine them into single filters for example if you want to simultaneously obtain a tiddler name and a field in that tiddlers content. The are however other methods to use filers such as in the set and `{{{ triple braces }}}` method.This is not a problem just a code pattern - however in the example you gave may not be one of them. 

However I do not know what the ref operator is in this example;
[ref<previouslyFoundId>]

In your first filter you know what myTiddler is and you are getting the value from its id field - so the output of this filter is an ID value
In the second filter you are using the result of the first filter, so if there was a ref operator you can do this;

[<myTiddler>get[id]ref[]]

If the ref operator can process the titles fed into it, in this case rather than a tiddler title it is the ID value as a title that is passed to the ref operator.

perhaps I could add more if you explain what you intend by the use of ref<id>

Regards
Tony

Mirko Richter

unread,
Sep 6, 2019, 1:41:04 AM9/6/19
to TiddlyWiki
Hi Tony,

thanks first for your explanation!

ref is just the name of the field that referrs to the id fetched before. You could also write field:ref<id>. So it is a case where the output of a filter-operator wouldn't be the input of the next but the parameter of the next filter-operator.

Regards,
Mirko

TonyM

unread,
Sep 6, 2019, 2:56:45 AM9/6/19
to TiddlyWiki
Mirko,

Sorry, I can't follow. Perhaps you should write it with nested lists so we can see exactly what you are after, then we can see if it can be simplified.

It may be strait forward but there is possibly some information missing from your example/question.

It may be a case of you asking a question about how to fix something, rather than asking the question that led to the problem.

Regards
Tony

PMario

unread,
Sep 6, 2019, 6:20:31 PM9/6/19
to TiddlyWiki
Hi
Most of the time there are several ways to achieve something in TW.

Using <$list filter... is 1 possibility. You can also use <$set filter, which may a different approach.

It depends on your usecase and the "data structure" how you store you content in a tiddler.

-mario
Reply all
Reply to author
Forward
0 new messages