Please help me to solve my Filter Error

Hello,

I am starting to develop some filter but now I am struggling.
Target is to have a Table of Content and to give over the tag name what is stored in a field value.
I was able to read out the field value (in my example it is simple TableOfContents).
But if I use it in the toc-selective-expandable I get the error message:

Filter error: Syntax error in filter expression

created: 20240722160217651
modified: 20240722212901635
myfield: TableOfContents
tags: 
title: XXX

<<toc-selective-expandable {{{ [<currentTiddler>get[myfield]] }}} >>

What is it I am doing wrong here? If I use {{{ [get[myfield]] }}} I get, as expected, “TableOfContents”.

Thx in advance
Stefan

You can’t use filtered transclusion syntax – {{{ [...] }}} – to specify parameters within the “short form” macro syntax – <<somemacro ...>>. Instead, use the new <$transclude $variable="..."/> syntax, like this:

<div class="tc-table-of-contents">
<$transclude $variable="toc-selective-expandable" tag={{{ [<currentTiddler>get[myfield]] }}}/>
</div>

You could also use the older <$macrocall ...> syntax, like this:

<div class="tc-table-of-contents">
<$macrocall $name="toc-selective-expandable" tag={{{ [<currentTiddler>get[myfield]] }}}/>
</div>

-e

Hi @EricShulman,

thank you.
It is nearby that what I am looking for.
But the TableOfContents in the SideBar is doing something different than expected :frowning:

This is my / your code I am using with some additional debugging information (I used the tiddlywiki.com homepage):

caption: {{$:/language/SideBar/Contents/Caption}}
created: 20140809114010378
list: HelloThere Learning [[Working with TiddlyWiki]] [[Customise TiddlyWiki]] Features Filters Languages Editions Plugins Platforms Reference Community About
list-after: $:/core/ui/SideBar/Open
modified: 20240723064540305
myfield: Learning
tags: $:/tags/SideBar
title: TableOfContents
type: text/vnd.tiddlywiki

currentTiddler: <<currentTiddler>>

storyTiddler: <<storyTiddler>>

myfield: {{{ [<currentTiddler>get[myfield]] }}}

language: {{ $:/language }}

<div class="tc-table-of-contents">
<$transclude $variable="toc-selective-expandable" tag={{{ [<currentTiddler>get[myfield]] }}}/>
</div>

And here is the strage result.
I think I need the information of the currentTiddler in the TableOfContent Tiddler in the SideBar???

Stefan

Hi @stefan_from_germany

In the SideBar, <<currentTiddler>> is undefined. You can use the <<currentTab>> variable instead.
If you want your code to work in the Story River and in the SideBar alike, you can use a <$tiddler> widget like this:


currentTab: <<currentTab>>

<$tiddler tiddler=<<currentTab>>>

currentTiddler: <<currentTiddler>>

storyTiddler: <<storyTiddler>>

myfield: {{{ [<currentTiddler>get[myfield]] }}}

language: {{ $:/language }}

<div class="tc-table-of-contents">
<$transclude $variable="toc-selective-expandable" tag={{{ [<currentTiddler>get[myfield]] }}}/>
</div>
</$tiddler>

Fred

The solution can be found here: