[TW5] filter="<setvariablename>"

79 views
Skip to first unread message

TonyM

unread,
Feb 2, 2018, 1:37:04 AM2/2/18
to tiddl...@googlegroups.com
Hi Folks,

Stymied again with a detail 

SOLUTION FOUND <$list filter=<<menufilter>> variable=null>

If working the following logic is great, as it selects a value for menufilter from one of three sources in priority order.

I have a variable set using the set widget

<$set name=menufilter value={{$menuname$!!menu-filter-$(menu-context)$}} emptyValue={{$menuname$!!menu-filter}}>
<$set name=menufilter value={{$menuname$!!menu-filter}} emptyValue="{{$:/PSaT/MyMenus/menufilterdefault}}">
<
<menufilter>>

<$list filter="
<menufilter>" variable=null>

Always displays


</$list>

The Problem is, I always see "Always displays" 
even when menu filter is say [is[current]tag[hello]] and the current tiddler is not tagged hello

The menu filter always returns the filter I want to use but the list seems to ignore it, but always testing true.

Thanks in advance
Tony

Mark S.

unread,
Feb 2, 2018, 12:31:17 PM2/2/18
to tiddl...@googlegroups.com

The operator <menufilter> is the same as "title<menufilter>" which is a constructor (it generates an item in your list).

Possibly try "[prefix<menufilter>suffix<menufilter>]"

Good luck,
-- Mark
Edit: Fix.

On Thursday, February 1, 2018 at 10:37:04 PM UTC-8, TonyM wrote:
Hi Folks,

Stymied again with a detail 

TonyM

unread,
Feb 2, 2018, 3:56:30 PM2/2/18
to TiddlyWiki
Mark,

That special use of prefix suffix again, I really can't understand the tiddlywiki.com entries on selector constructors.

Thanks mark I will test it soon and include the missing <

Regards
Tony

Mark S.

unread,
Feb 2, 2018, 4:11:14 PM2/2/18
to TiddlyWiki
A small number of filter operators don't really filter -- they ignore anything earlier in the filter chain and create their own stream of items. These operators are called constructors.

The prefix/suffix trick comes about because there isn't an equals operator, exactly. You could use field:title<variable> perhaps. That should work as long as the tiddler actually exists. I kind of like the prefix/suffix thing because it works even if the tiddler doesn't work (like if you were looking for a particular tag, which isn't also a tiddler).

-- Mark

TonyM

unread,
Feb 2, 2018, 8:09:59 PM2/2/18
to TiddlyWiki
Mark and all,

Still no success, what ever is causing this intransigence of tiddlywiki, whilst it may have something to do with my ignorance it is an example of where tiddlywikis syntax and pecularities need review.

All I wanted for Christmas (not really) was the ability to provide a filter into a list statement using fields and variables. nothing more.

See some of my experiments below, with alternate filter formats listed until I change them.

I refactored the code so the list uses a value passed into a macro eg; [is[current]tag[working]]

<$list filter="$menufilter$" variable=null>

also
<$list filter="<menufilter>" variable=null>

also
<$list filter="[prefix<menufilter>suffix<menufilter>]" variable=null>
is never true OR disrupts menubutton

is[current]tag[working]
Never true
<$list filter="[prefix<menufilter>suffix<menufilter>]" variable=null>

Always true
<$list filter="[<menufilter>]" variable=null>

Never true
<$list filter="[field:title<menufilter>]" variable=null>

Always true
<$list filter="field:title<menufilter>" variable=null>

[is[current]tag[working]]
<$list filter="field:title<menufilter>" variable=null>
Always true


<$list filter="[field:title<menufilter>]" variable=null>
Never true


Argggh
Tony

TonyM

unread,
Feb 2, 2018, 10:36:26 PM2/2/18
to TiddlyWiki
Found it;

<$list filter=<<menufilter>> variable=null>

Works, note no " "

Regards
Tony
Reply all
Reply to author
Forward
0 new messages