A Gloom

The code works with data provided by Jim and it also sorts!
To give a try download data of Jim post above and drag and drop to
tiddlywiki.com
Next in a new tiddler paste the code of my last post you will see

[image: image.png]



Best wishes
Mohammad


On Tue, Aug 31, 2021 at 7:55 AM A Gloom <[email protected]> wrote:

> Soren, sorry about the delay-- this something low on my list of too many
> things to do, so I haven't been dedicating enough time to it.  Let me
> export some shell tiddlers with the fields and values from the real world
> attempt at this issue.
>
> Mohammad, good to see you responding as well.  I tried your solution, it
> displayed the field values with counts but didn't sort them by the counts
> (count of fields with each value).  Playing with things-- I inserted a
> <<criteria>> in the list so that each list result (see [1] beow) would show
> the criteria variable for each.  It's displaying: [tag[zz@]zztopiccount[]]
> **(note the " zztopiccount ", zztopic being the field name)
> It appears that it's not applying <currentTiddler> from the criteria $vars
> widget.  The entire code (yours altered to work with my tiddlers selection)
> I used is below [2].  It displays what is expect but not sorting.
>
> [1]
> <li><$link/> (<$count filter="[tag[zz@AYoS]ayostopic<currentTiddler>]"/>)
> ::: <<criteria>></li>
>
> [2]
> <$vars criteria="[tag[zz@]zztopic<currentTiddler>count[]]">
> <ul>
> <$list filter="[tag[zz@]each[zztopic]get[zztopic]]
> +[!sortsub:integer<criteria>]">
> <li><$link/> (<$count filter="[tag[zz@]zztopic<currentTiddler>]"/>) :::
> <<criteria>></li>
> </$list>
> </ul>
> </$vars>
>
>
> On Monday, August 30, 2021 at 5:20:19 PM UTC-4 amreus wrote:
>
>> Mohammad.
>>
>> That is brilliant!
>>
>> I made many attempts at a filter but never was able to get it.  The
>> missing piece for me is the currentTiddler in the criteria variable.  In
>> the context of the list, currentTiddler is the surname.  It makes sense
>> after I see it.  This indicates I am still not understanding macros and
>> variables correctly.
>>
>> Thanks again!
>>
>>
>> On Monday, August 30, 2021 at 4:29:58 PM UTC-4 Mohammad wrote:
>>
>>> Ah, sorry I did not notice a sorted output was requested! This is the
>>> final solution with sort capability!
>>>
>>> ```
>>> <ul>
>>> <$vars criteria="[all[tiddlers]surname<currentTiddler>count[]]">
>>> <$list filter="[all[tiddlers]!is[system]each[surname]get[surname]]
>>> +[!sortsub:number<criteria>]">
>>>
>>> <li><$link/>(<$count
>>> filter="[all[tiddlers]surname<currentTiddler>]"/>)</li>
>>> </$list>
>>> </$vars>
>>> </ul>
>>> ```
>>> Note, this works in TW 5.1.23+
>>>
>>>
>>>
>>> Best wishes
>>> Mohammad
>>>
>>>
>>> On Mon, Aug 30, 2021 at 11:58 PM amreus <[email protected]> wrote:
>>>
>>>> Thank you Mohammad,
>>>>
>>>> I have learned much from your wikis on github.
>>>>
>>>> However, in your enthusiasm I think you over-looked the desire to sort
>>>> the names by count.
>>>>
>>>> I thought I saw an old post that showed a possible way by using an
>>>> intermediate list, prefixing the count to the title with a delimiter,
>>>> sorting the list, and finally splitting the count from the title - but I am
>>>> unable to find it using search, and also do not recall if the method could
>>>> be applied in this case.
>>>>
>>>>
>>>> On Monday, August 30, 2021 at 11:28:26 AM UTC-4 Mohammad wrote:
>>>>
>>>>> Jim,
>>>>> Give a try with this script!
>>>>>
>>>>> <ul>
>>>>> <$list filter="[all[tiddlers]!is[system]each[surname]get[surname]]">
>>>>> <li><$link/>(<$count
>>>>> filter="[all[tiddlers]surname<currentTiddler>]"/>)</li>
>>>>> </$list>
>>>>> </ul>
>>>>> You can also replace <$link/>  with <$text text=<<currentTiddler>>/>
>>>>>
>>>>>
>>>>> Best wishes
>>>>> Mohammad
>>>>>
>>>>>
>>>>> On Sun, Aug 29, 2021 at 6:15 PM Jim <[email protected]> wrote:
>>>>>
>>>>>> Not OP but in my case, I'd like to generate a list of surnames sorted
>>>>>> by how many tiddlers share the same surname field.
>>>>>>
>>>>>> Output should look similar to this:
>>>>>>
>>>>>>
>>>>>>    - Took (26)
>>>>>>    - Brandybuck (24)
>>>>>>    - Baggins (24)
>>>>>>    - Bolger (22)
>>>>>>    - Boffin (18)
>>>>>>    - Gardner (14)
>>>>>>    - Gamgee (7)
>>>>>>    - Burrows (7)
>>>>>>
>>>>>>
>>>>>> On Sunday, August 29, 2021 at 9:10:08 AM UTC-4 Soren Bjornstad wrote:
>>>>>>
>>>>>>> Can you maybe upload a small wiki with some tiddlers that could
>>>>>>> serve as an example? It's pretty difficult to go into more depth without
>>>>>>> any data to try it on.
>>>>>>>>
>>>>>>>> teric wikiery would be greatly appreciated...
>>>>>>>>>>
>>>>>>>>> --
>>>>>> 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/4feea918-07db-46d9-9489-a23cea65658dn%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/tiddlywiki/4feea918-07db-46d9-9489-a23cea65658dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> 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/d9293190-4bca-46ef-923a-d0ce0a8b0270n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/tiddlywiki/d9293190-4bca-46ef-923a-d0ce0a8b0270n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> 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/087e92e0-c4d2-4558-89cb-207020ed072dn%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/087e92e0-c4d2-4558-89cb-207020ed072dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAAV1gMCnAWHRjHQ2D7cM8DhXQ1QTvkisD0pV6e_0s6GdPk6ZTQ%40mail.gmail.com.

Reply via email to