Getting tiddlers from a list

In my genealogy TW there are person tiddlers and event tiddlers. I have a variable with a list of person tiddlers, a title list. From this list I want all their events.

If I had one person title in the variable list1 this would work, but list1 has multiple Tiddler titles.

[tag[event]search:people<list1>]

UPDATE: people field is a title list field.

How could I make this work?

Thanks

Craig

1 Like

Here’s my version, if I understood you correctly. It works by checking if the number of people listed changes after removing any people listed in the people field.

<$let people="[[Joe]] [[John]]"
count={{{[enlist<people>count[]]}}}
>

Count: <<count>>

<$list filter="[tag[event]]:filter[enlist<people>remove{!!people}count[]compare:number:lt<count>]"/>

</$let>
2 Likes

As mark shows you to use the enlist operator, when you use a variable or field (that happens to be a list) you need to break it apart into seperate titles. Depending on the circumstances enlist/enlist-input/list operators.

  • You may be misled by the fact tags are also fields containing a list, however tiddlywiki comes with operators specific to tag manipulation.
  • The newest release checkbox widget now has a listField parameter
  • Otherwise managing lists we use the various filters and the actionlistops widget.
1 Like

You will probably need to give some more info. I don’t know how the events and people are connected, so I’ll assume that each Event Tiddler has a “people” field that lists those who attended the event.

<dl>
<$let theirEvents={{!!people}}>
<$list filter="[<theirEvents>enlist-input[]]">
<dt><$link /></dt>
<$list filter="[tag[event]contains:people{!!title}]">
<dd>{{!!title}}</dd>
</$list>

</$list>
</$let>
</dl>

In a separate tiddler with its own “people” field that lists the names of who you want the events attended, it could end up like this…

1 Like

@Mark_S thank you. I would not have come up with this solution. @TW_Tones Thank you for the further clarification.

Craig

Hi @Mark_S

What if I want to list all events in them both persons were attending! I came up with below filter solution but seems a little complex. I also used person with space in his name.

<$let participants="[[Joe]] [[John Roscoe]]" 
      num = {{{ [enlist<participants>count[]] }}}
      screen= "[get[people]enlist-input[]]
               :intersection[enlist<participants>]
               :and[count[]compare:number:eq<num>]"
>


<$list filter="[tag[event]filter<screen>]">
<$link/> - Participants: <$text text={{{[enlist{!!people}join[, ]]}}} />
<br>
</$list>


</$let>

In my first version, I just checked that the count had changed after removing the people listed in the events tiddler. So, to check if both people have attended, then the final count after removal should be exactly zero.

So I think that this revised version should work. I haven’t tested, since I don’t want to spend the time creating data. Also, you no longer need the count variable.

<$list filter="[tag[event]]:filter[enlist<people>remove{!!people}count[]compare:number:eq[0]]"/>

Works as expected!

More semantic, yet simpler.