On Wednesday, June 30, 2021 at 11:46:17 PM UTC-7 JJ wrote:

> A follow up question: Would it be possible to sort the table by the column 
> "Conversations" in descending order of number of conversations?
>

You can use the sortsub[] filter operator to sort the Person list, based on 
the number of Conversations that list that person.

Try this:
\define byCount() 
[<currentTiddler>listed[contact]tag[Conversation]!has[draft.of]count[]]
<table>
  <tr><th>Person</th><th>Conversation Count</th></tr>
   <$list filter="[tag[Person]!sortsub:integer<byCount>]">
      <tr><td><$link/></td><td><$text text={{{ [subfilter<byCount>] 
}}}/></td></tr>
   </$list>
</table>
 
Notes:
* The byCount() macro is needed because the sortsub parameter is itself a 
filter syntax that contains square brackets, and you can't "nest" the 
square brackets.
* I used <currentTiddler>listed[contact]tag[Conversation] ("find all 
tiddlers with the currentTiddler listed as a contact that are also tagged 
as Conversations") rather than 
tag[Conversation]contains:contact<currentTiddler> ("find all tiddlers 
tagged as Conversations that contain the currentTiddler in the contact 
field").  Although these filters may *seem* to be equivalent, they produce 
different results.  I have to admit that I'm not sure why... but the 
"listed" filter produces the correct results, while the "contains" filter 
doesn't.
* I added !has[draft.of] to the filter to exclude any tiddlers that are 
currently being edited
* I re-used the <byCount> filter in a $text widget to display the actual 
count value

enjoy,
-e

-- 
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/d50a65bc-57b2-406a-8d07-67ab2f290fedn%40googlegroups.com.

Reply via email to