Search filter with variable

Hello everybody!
There is another syntax thing I can not get on with and so I am asking politely for your help again. It’s about my little image list project. In the tiddler where the images are listed I want to see if an image tiddler is used as an image in another tiddler (I do not mean being referenced but being used with [img[]]). In principle that works with:

<$list filter="[!is[system]search::literal[MyImageTiddler.png]]">

But I don’t know how to spell that using a variable instead of a name:

<$list filter="[!is[system]is[image]]">

Link: <$link/>

<$image source=<<currentTiddler>> width="180px"/>

Is used by:

<$list filter="[!is[system]search::literal[<<currentTiddler>>]]">

<$link to={{!!title}}><$view field="title"/></$link>

</$list>

</$list>

In my code the search line looks for "<<currentTiddler>>" and not for the content of the variable, the tiddler name. How should I do that in a correct manner?
Thanks a lot again in advance to all of you helpful TiddlyWiki pros!

Best wishes
Oliver

Here’s how to use a variable in a filter expression:

<$let variable="value">

{{{ [<variable>] }}}

</$let>

Inside a macro, you have more options :

$variable$ for string substitution (with the parameters of the macro), $(variable)$ for string substitution with a variable defined outside of the macro, and <<__variable__>> for using a parameter as a variable (e.g when affecting a value to a widget attribute). In filters, <<__variable__>> becomes <__variable__>, just like <<variable>> (e.g a variable defined with a let widget) becomes <variable>.

Just to clarify what telumire says; Your code should be:

Thus the ] ends the outer expression, whereas you only use <...> inside it.

Further, I recommend you use ' instead of single " so you can also handle titles that contain ". Another way is to encapsulate with triple quotes """ .... """

1 Like

Thank you so much, problem solved. And again I’ve something learned with your help! :sunflower: