How to sort by filter count result

I am a mathematic Ph.D student, and I use TiddlyWiki to manager my academic data, including papers, books, journals and scholars.

I hope to show the fields in which each scholar has published papers, as well as the number of papers published in each fields, it works since there is a field named “topics” in each paper tiddler, I just filter all the paper published by the scholar, and use enlist-input[] to obtain all the topics, and then use count[] to obtain the numbers. Here is my wikitext code

<$list filter="[prefix[$:/academic-lib/]has[topics]get[topics]enlist-input[]unique[]]" variable="topic">
<$let num={{{ [prefix[$:/academic-lib/]has[topics]regexp:topics<topic>count[]] }}}>
<tr><td align="right"><b><<topic>></b></td><td><<num>></td><td><$transclude tiddler=<<dict>> index=<<topic>>></$transclude></td></tr>
</$let>
</$list>

and this is the result

But now I hope to sort the topic by count number, how can I do this?

Thank you to everyone who took the time to read my post and to those who were willing to help.

OK,the problem is solved by using sortsub operator. Here is the code

<$let num-filter="[all[tiddlers]prefix[$:/academic-lib/]has[topics]get[topics]regexp:topics<currentTiddler>count[]]">
<$list filter="[prefix[$:/academic-lib/]has[topics]get[topics]enlist-input[]unique[]!sortsub:number<num-filter>limit[50]]" variable="topic">
<$let num={{{ [subfilter<all-filter>regexp:topics<topic>count[]] }}}>
<tr><td align="right"><b><<topic>></b></td><td align="center"><<num>></td><td><$transclude tiddler=<<dict>> index=<<topic>>></$transclude></td></tr>
</$let>
</$list>
</$let>

Greetings @shenzhy16, and welcome to the forum.

I found your approach to using TiddlyWiki for managing academic data quite interesting. As you may be aware, TiddlyWiki supports BibTeX integration, allowing you to gather data from sources such as Elsevier, ACS, IEEE, and others, which can then be easily imported into your wiki. Additionally, you have the flexibility to add as many custom fields as necessary.

Thank you @Mohammad, I’m really happy to join this forum and talk with you. Actually I’ve been using TiddlyWiki for years. At first, my needs were simple — I just used it for note-taking, like managing definitions, theorems, and proofs. As time went on and my demands grew, I learned advanced Wikitext syntax and even tried writing my own plugins. Lately, I plan to import my reference materials into TiddlyWiki for easier note-taking on the papers I’ve read. I’ve made a plugin for this, and it’s working great so far. I will open-source it once it’s more polished (right now it’s in Chinese, and I’ll switch it to English before open-sourcing). Also, my plugin can generate BibTeX from tiddler fields(see the picture), and the result really satisfies me. About data sources, I’ve just written a Python program to scrape data from zbmath, turn it into JSON, and import it into TiddlyWiki, and it’s working well for now.

1 Like

I see you are using TiddlyWiki in a very professional way—wonderful!

Your developed tools have automated the tasks of the reference manager in TiddlyWiki, and I am eager to explore and try them once you have published them.

Keep up the great work on TiddlyWiki development and applications!

Thank you for your encouragement! I will keep developing and try to contribute to the community

2 Likes