Variable for field name in filter

78 views
Skip to first unread message

stevesuny

unread,
Jul 14, 2017, 3:56:07 PM7/14/17
to TiddlyWiki
This filter works: <$list filter="[field:instructor{!!field-value}]">

My tiddler has field-name=instructor

How do I transclude {{!!field-name}} into the filter to replace "instructor"? 

(I've tried every possible solution but the right one :)

Thans, //steve.

Mark S.

unread,
Jul 14, 2017, 4:04:47 PM7/14/17
to TiddlyWiki
Hi Steve,

Is there a typo here? In the filter you say field-value. But in your text you say field-name. Which is it?

Mark

stevesuny

unread,
Jul 14, 2017, 4:28:18 PM7/14/17
to TiddlyWiki
My tiddler has these fields:

field-name: instructor
field-value: Chiang

I want to search for all tiddlers for which field:instructor = Chiang.

This works: filter="[field:instructor{!!field-value}]"

But this doesn't:

filter="[field:{!!field-name}{!!field-value}]"

Sorry to be confusing,

//steve.

Mark S.

unread,
Jul 14, 2017, 4:52:34 PM7/14/17
to TiddlyWiki
Yeah, you can't use {{!!field-name}} notation to substitute for a filter operator suffix AFAIK. Use a macro to concatenate and form your filter instead, like:

\define indirect() [field:$(field-name)$[$(field-value)$]]
<$vars field-name={{!!field-name}} field-value={{!!field-value}}>
<$list filter=<<indirect>> />
</
$vars>

HTH
Mark

stevesuny

unread,
Jul 14, 2017, 5:05:18 PM7/14/17
to TiddlyWiki
Worked like a charm.

OK, I would never have gotten to figure that out. It seems these generic \define sitting on top of macros or templates are very powerful and useful addition to the general process of transclusion. 

Thanks for your help! I'll post the results in another thread soon. 

//steve.

cmari

unread,
Jul 15, 2017, 12:14:59 PM7/15/17
to TiddlyWiki
Could you not also use:

<$list filter="[{!!field-value}listed{!!field-name}]">
<<currentTiddler>><br>
</$list>

cmari
Reply all
Reply to author
Forward
0 new messages