Filter: how to deduplicate?

89 views
Skip to first unread message

Erwan

unread,
Dec 23, 2020, 7:16:11 AM12/23/20
to TiddlyWiki

Hi everyone,

It's good to be back playing with TW :)

Sorry I'm very rusty with filters and I'm probably missing something simple. I"m trying to obtain a list of unique "answers" from a list of questions like this:

<$list filter="[tag[question]get[answer]]">

</$list>

Currently I obtain something like this because there can be several "question" tiddlers with the same answer:

Eric Shulman

unread,
Dec 23, 2020, 7:36:01 AM12/23/20
to TiddlyWiki
On Wednesday, December 23, 2020 at 4:16:11 AM UTC-8 Erwan wrote:
I'm trying to obtain a list of unique "answers" from a list of questions like this:
<$list filter="[tag[question]get[answer]]">

</$list>
...there can be several "question" tiddlers with the same answer...

Use the "each:value[]" filter, like this: 
<$list filter="[tag[question]get[answer]each:value[]]">

</$list>


enjoy,
-e

Erwan

unread,
Dec 23, 2020, 8:08:18 AM12/23/20
to TiddlyWiki
Perfect!
Thank you Eric :)

Saq Imtiaz

unread,
Dec 23, 2020, 9:08:27 AM12/23/20
to TiddlyWiki
@Erwan just for reference, you could also do:

[tag[question]get[answer]unique[]]  

Mark S.

unread,
Dec 23, 2020, 10:07:55 AM12/23/20
to TiddlyWiki
I worry a bit about the unique operator -- why isn't it documented?

Saq Imtiaz

unread,
Dec 23, 2020, 11:33:09 AM12/23/20
to TiddlyWiki
Has to be an oversight when it was added. It is a relatively straight forward but useful listops operator.

TW Tones

unread,
Dec 23, 2020, 10:42:37 PM12/23/20
to TiddlyWiki
Inside tiddlywiki - the undocumented features !
Reply all
Reply to author
Forward
0 new messages