Transclude current tilder's field content into filter

Hello,

I’m using “code” field as a sorting/address system for my notes. It’s more or less a tree structure. So for example I consider 101.1 as a child of 101. Now I want to filter out all tiddlers containing current tiddler’s code. Here’s what I’m trying:


<$let 
  codename={{!!code}}
>

<$macrocall $name=table-dynamic filter="search:code[<<codename>>]]" class="w-100" fields="code tbl-expand title tags"/>
</$let>

I’ve tested that <<codename>> returns correct content (say 101), and when I use 101 directly in the filter it works as expected. But when I put <<codename>> in the filter I get “The filter input is empty”. Is there a specific format I need to follow?

Thank you so much for your help.

Hi there. A couple things that need to be addressed.

  • Brackets inside of filters are only single, so <codename> instead of the normal double <<codename>>
  • Filter runs have brackets around them [search:...
  • The right bracket after code code[ tells the filter to expect a literal value, cancelling out the <code
  • You have 3 “lefts” and 4 “rights”, looks like maybe the left one got cut off from a copy/paste?

A cleaned up version of that is [search:code<codename>]. If codename was a literal value instead of a variable, it’d have been [search:code[codename]] just for reference / comparison. And, seeing as how you’re setting the value as a transclusion anyways, you might try [search:code{!!code}] to save you the step of setting the variable.

I usually remember it as “only go up to 2 deep” meaning 2 lefts unmatched by a right.

3 Likes

Thank you so much! [search:code{!!code}] works for me.