unexpected count for filtered transclusion?

40 views
Skip to first unread message

maki aea

unread,
Dec 29, 2020, 12:35:21 AM12/29/20
to TiddlyWiki
"""
doing the following in tiddlywiki.com gives some results i wasn't expecting, could anyone please show me what i am doing wrong?

<<tabs "[[recall]] [[lyrics]] [[tips]]" "[[recall]]" "$:/state/tab/deck">>

<$count filter="{{{ [tag{$:/state/tab/deck}] }}}"/>

<$count filter="[tag[recall]]"/>

<$count filter="{{{ [!is[current]tag{$:/state/tab/deck}]] }}}"/>

<$count filter="{{{ enlist[tag{$:/state/tab/deck}] }}}"/>

why does the filtered transclusion produce a non-zero count? there are no tiddlers tagged "recall" in the current tiddlywiki, so does the transclusion do something different to what i am expecting (i.e. a match to the second filter?)
the third filter leads me to think the current tiddler is included regardless, but what about the remaining count of 1?
how does enlist then add another to the count in the fourth filter?
"""

warmest wishes, maki

Mark S.

unread,
Dec 29, 2020, 1:23:19 AM12/29/20
to TiddlyWiki
The triple brace notation indicates that the filter inside the braces will be evaluated. BUT, they don't get evaluated if they are in strings. Which yours are. So in each of yours, the {{{ and }}} get evaluated as if they were tiddler names.

More to the point, you don't use triple brace notation within filters -- you don't need them.

Only the 2nd filter is correct. The 4th filter is not only incorrect because of the triple braces, it is incorrect because it is missing a left square bracket in front of "enlist". 

I think you're trying to count the number of tabs. I guess the way to do this would be to give each tab tiddler a tag, like "mytab".

Then your tab macro would look like

<<tabs "[tag[mytab]]" "[[recall]]" "$:/state/tab/deck">>

and you could count the tabs like

<$count filter="[tag[mytab]]" />

maki aea

unread,
Dec 29, 2020, 5:17:47 AM12/29/20
to TiddlyWiki

perfect, that worked, thank you mark! i am using tabs to set the state, and filtering by tag[state], i was (also) using the count to debug the single-word tiddler non-square bracket-requirement — there is one more subsequent layer of filter transclusion in another macro, when i followed your kind advice and put the braces in that subsequent layer without quoting to string, to evaluate there instead, it worked! thanks so much!
Reply all
Reply to author
Forward
0 new messages