Thank you so much for the solution and extensive explanation! It's working 
perfectly.

A follow up question: Would it be possible to sort the table by the column 
"Conversations" in descending order of number of conversations? I can 
imagine that it's hard with the current solution because TW renders the 
table line by line for each Person.

I also tried using TiddlyTables. Using the tbl-anything column with a 
custom column template 

<td>
<$count filter="[tag[Conversation]contains:contact<currentRecord>]"/>
</td> 

works the same as above solution and shows the correct number of 
conversations per contact.
I can click on the column header to sort it, but nothing happens. Also I 
tried changing the sort mode in the settings without luck. I guess the 
table is still being rendered line by line alphabetically by person because 
that is the initial filter expression.

Any ideas how to sort the column?
Thanks again!
JJ
On Wednesday, 30 June 2021 at 13:55:14 UTC+2 Soren Bjornstad wrote:

> Hi JJ,
>
> On Wednesday, June 30, 2021 at 6:18:58 AM UTC-5 JJ wrote:
>
>> Now I'd like to create a table, which shows me the People I talked to 
>> with the amount of conversations I had with them. Sometimes, the 
>> conversation is with more than one person, so I write two names in the 
>> contact-field, like "PersonOne PersonTwo". I understood that separating 
>> those, I should use the enlist-operator.
>>
>
> I don't see you using the enlist operator in the snippet above? Anyway, I 
> would use contains <https://tiddlywiki.com/#contains%20Operator>, not 
> *enlist* – it's possible to do it with *enlist*, but makes things 
> unnecessarily trickier.
>  
>
>> I tried the following, but I cannot find out, what to write in the space 
>> marked with ????. If I try to enter one Persons name manually, the correct 
>> count shows up in all rows, as expected. Somehow, I need to reference the 
>> currentTiddler, but I don't know how.
>>
>
> You need to use a *soft parameter* with <> or {} instead of [], which 
> fill in the value of a variable or field respectively. So your filter would 
> look like:
>
> [tag[Conversation]contains:contact<currentTiddler>]
>
> Or equivalently:
>
> [tag[Conversation]contains:contact{!!title}]
>
> See Filters and Transclusions 
> <https://groktiddlywiki.com/read/#Filters%20and%20Transclusions> for more 
> on this.
>
> It's worth noting you can take advantage of the $count widget and some 
> default parameters of $link to simplify all this:
>
> <$list filter="[tag[Person]sort[caption]]">
> <tr>
>   <td><$link /></td>
>   <td><$count 
> filter="[tag[Conversation]contains:contact<currentTiddler>]"/></td>
> </tr>
> </$list>
>
> (But did you really want the title to display for each person after you 
> sorted by the caption? You might prefer:
>
> <td><$link to={{!!title}}><$transclude 
> field="caption">{{!!title}}</$transclude></$link></td>
>
> ...which will show the caption if it exists and the title otherwise, 
> linking to the title in either case.)
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3c83e8f4-14c1-4f6a-8caf-860d4b9da1b8n%40googlegroups.com.

Reply via email to