Nested lists using list operator in outer list

103 views
Skip to first unread message

passingby

unread,
Jan 28, 2018, 1:50:02 AM1/28/18
to TiddlyWiki
Friends,
I have a tiddler $:/.user/lists/Circles which contains : personal family friends acquaintances relatives work. These are to be used as tags from a dropdown for contact tiddlers. So a contact could be a personal contact, or someone from family or a friend etc

I am trying to produce a list like this

Personal:
   [[contact 1]]
   [[contact 2]]
Family
   [[contact 3]]
   [[contact 4]]

Why does this not work? 

<$list filter="[list[$:/.user/lists/Circles!!text]]" variable="item">

<<item>>
<$list filter="[tag[contact]tag[item]]">

</$list>
</$list>

The outer list works and produces a list: 
    personal 
  family 
  friends 
  acquaintances 
  relatives 
  work
   
But the inner list does not give anything. Why does 'item' give out correct value in the outer list but has no effect in the inner one?


I tried this too:


<$list filter="[list[$:/.user/lists/Circles!!text]]" >

<
<currentTiddler>>
<$list filter="[tag[contact]tag[currentTiddler]]">

</$list>

</$list>



The output is same as above. Why does currentTiddler does not have any effect when in the inner list. 


I suspect this has something to do with the fact that the filter is using a list operator working on text of a tiddler and not on actual tiddlers. I mean that currentTiddler refers to a non-existent tiddler.

And this work:

<$list filter="[list[$:/.user/lists/Circles!!text]]">


{{!!title}}
<$list filter="[all[current]tagging[]tag[contact]]">


</$list>
</$list>




Eric Shulman

unread,
Jan 28, 2018, 2:58:24 AM1/28/18
to TiddlyWiki
On Saturday, January 27, 2018 at 10:50:02 PM UTC-8, passingby wrote:
Why does this not work? 
<$list filter="[list[$:/.user/lists/Circles!!text]]" variable="item">

<<item>>
<$list filter="[tag[contact]tag[item]]">

</$list>
</$list>
The outer list works and produces a list: ...
But the inner list does not give anything. Why does 'item' give out correct value in the outer list but has no effect in the inner one?

To use a *variable* value as the operand of a filter, use angle brackets.... like this:
<$list filter="[tag[contact]tag<item>]">

The thing to remember is that the brackets go with the TYPE of operand....

[foo] is a literal value
<foo> is a variable reference
{!!foo} is a reference to field "foo" in the current tiddler
{SomeTiddler} is a reference to the text field contents of a tiddler named "SomeTiddler"
{SomeTiddler!!foo} is a reference to the value of the "foo" field in tiddler "SomeTiddler"

enjoy,
-e

passingby

unread,
Jan 28, 2018, 3:02:57 AM1/28/18
to TiddlyWiki
Thank you Eric!

passingby

unread,
Jan 28, 2018, 3:26:03 PM1/28/18
to TiddlyWiki
Is there a way to suppress (not display) the item in outer list IF it does not have any children? I mean lets say not display 'acquaintance' when there are no contacts tagged with 'acquaintance'? 

Although as the TW start to fill with data I feel all types on contacts would come in.

Mark S.

unread,
Jan 28, 2018, 5:53:19 PM1/28/18
to TiddlyWiki
I might try inserting another nested list before <<item>>, like:

<$list filter="[tag[contact]tag<item>limit[1]]">

The limit operator makes sure that the inner list will be looped only once (if at all).

-- Mark

passingby

unread,
Jan 28, 2018, 11:30:01 PM1/28/18
to TiddlyWiki
Wonderful. Thank you Mark! So now this code is working for me:

<$list filter="[list[$:/.shavin/lists/EventCircles!!text]]" variable="item">
   <$list filter="[<item>tagging[]tag[contact]limit[1]]">
      <<item>>
   </$list>
<$list filter="[<item>tagging[]tag[contact]]">

</$list>
</$list>

This is great trick to learn. 
Reply all
Reply to author
Forward
0 new messages