FET and NestedSliders

31 views
Skip to first unread message

Chris Eichenberg

unread,
Nov 10, 2025, 8:49:30 PMNov 10
to TiddlyWikiClassic
Does anyone know how to do an FET grouped by first character ( or List all Tiddlers in an "A-Z" Grouping ) that and incorporate a NestedSlider in the output? 

So like +++!![ GROUP ] tiddlers === or some variation. 

I tried my limited knowledge, tried some AI, a wash. The begin ' ' and end ' ' seems to handle the NestedSlider part. The `getGroupTitle(tiddler, context)` function seems to be causing the problem. I did get close with this `return "+++!!["+(context.lastGroup?context.lastGroup:"no tags")+"]";` and `end ' "===\n" '` only I got matryoshka(?) effect.

I did stumbled upon Tobias Beer's TiddlerTabsPlugin on GitHub. The documentation was on tiddlyspace and was not picked by the Wayback Machine. So I don't know if it could filtered by tag.


Yakov

unread,
Nov 15, 2025, 10:54:37 AMNov 15
to TiddlyWikiClassic
Hi Chris, I guess, fet is not suitable for that, since it has no notion of grouping, and what you are looking for can't be expressed in "for each tiddler" terms. Still, you can hack your way using a helper that will add grouping by treating it as "setting delimeters" between tiddlers, delimeters like these:

+++!![ GROUP_1 ]
<nothing – for most tiddlers>
=== <linebreak(s)> +++!![ GROUP_2 ]
...
===

Note that this will likely work slowly (O(n^2) where n is the number of tiddlers). The idea would be to have the script part with helpers like these (pseudocode):

const allTiddlersSortedByTitle = ...
const getStartDelimeter = (title) => {
  const tiddlerIndex = allTiddlersSortedByTitle.findIndex(tid => tid.title == title)

  const isFirst = tiddlerIndex == 0
  if(isFirst) return "+++!![ GROUP_1 ]"

  // next one starts from a different letter
  const isLastInGroup = allTiddlersSortedByTitle[tiddlerIndex + 1][0] != title[0]
  const groupLabel = ...
  if(isLastInGroup) return "=== \n +++!!["+ groupLabel +"]"

  return ""
}

and add "===" to the end epxression.

вторник, 11 ноября 2025 г. в 04:49:30 UTC+3, komet...@gmail.com:

Reto

unread,
Nov 21, 2025, 9:06:35 AM (12 days ago) Nov 21
to TiddlyWikiClassic
I have a FET which groups tiddler by the first letter of a field last_name:
Screenshot 2025-11-21 150303.png

Here is the code:

<<forEachTiddler
   where
   'tiddler.tags.contains("Mensch")'
   sortBy
      'tiddler.fields.last_name'
   script
       '
        function getGroupCaption(tiddler) {
            return tiddler.fields.last_name.substr(0,1);
        }

        function getGroupTitle(tiddler, context) {
            if (!context.lastGroup || context.lastGroup != getGroupCaption(tiddler)) {
                context.lastGroup = getGroupCaption(tiddler);
                return "!!" + (context.lastGroup?context.lastGroup:"no tags") + "\n";
            } else
                return "";
        }

       function writeLine(tiddler, context, index, count, noOfCol) {
           var line = "";
           if(index == 0) {
              context.lastPagination = 0;
              line = "\n";
           }
           // add a column
           if(index - context.lastPagination == Math.ceil(count / noOfCol)) {
              line += "}}}{{boxSmall{\n";
              context.lastPagination = index;
           }
           // output for group
           line += getGroupTitle(tiddler, context);
           // output for tiddler
           var lastName;
           if(tiddler.fields.last_name == undefined) {
              lastName = "Unbekannt";
           } else {
              lastName = tiddler.fields.last_name;
           }
           line += "* " + "[["+ lastName + " " + tiddler.fields.first_name + "|" + tiddler.title +"]], " + tiddler.fields.company;
           line += "\n";
           return line;
       }
       '
   write
      'writeLine(tiddler, context, index, count, "$1")'
   begin
      '"{{boxContainer{{{boxSmall{"'
   end
      '"}}}}}}"'
>>

If this code is put into a tiddler "PersonList", it can be called like this > <<tiddler PersonList with:"4">>

Not sure if this is of any help with the NestedSliders ...

Yakov

unread,
Nov 23, 2025, 6:09:11 AM (10 days ago) Nov 23
to TiddlyWikiClassic
Hi Reto, thanks for sharing,

>  Not sure if this is of any help with the NestedSliders

It is, for sure. It illustrates how adding "delimeters" may work, with getGroupTitle being analog of getStartDelimeter like I have described it. The great thing about your input is that it's a working example, so one can modify it and see the results. I've made a draft that Chris can adapt further to his needs (I didn't touch writeLine much, only removed using specific field, and added the sliders dilimeters):

<<forEachTiddler
   sortBy 'tiddler.title'
   script '
        function getGroupCaption(tiddler) {
            return tiddler.title.substr(0,1)
        }

        function getGroupTitle(tiddler, context) {
            if(context.lastGroup == getGroupCaption(tiddler)) return ""

            const isFirstGroup = !context.lastGroup
            context.lastGroup = getGroupCaption(tiddler)
            return (isFirstGroup ? "" : "===\n\n") +

           
   "+++[" + (context.lastGroup ? context.lastGroup : "no tags") + "]\n"

        }

       function writeLine(tiddler, context, index, count, noOfCol) {
           var line = "";
           if(index == 0) {
              context.lastPagination = 0;
              line = "\n";
           }
           // add a column
           if(index - context.lastPagination == Math.ceil(count / noOfCol)) {
              line += "}}}{{boxSmall{\n";
              context.lastPagination = index;
           }
           // output for group
           line += getGroupTitle(tiddler, context);
           // output for tiddler
           var lastName = tiddler.title;
           line += "* " + "[["+ lastName + " " + tiddler.fields.first_name + "|" + tiddler.title +"]]";

           line += "\n";
           return line;
       }
       '
   write 'writeLine(tiddler, context, index, count, "$1")'
   begin '"{{someClassIfNeeded{"'
   end '"}}}"'
>>

пятница, 21 ноября 2025 г. в 17:06:35 UTC+3, Reto:
Reply all
Reply to author
Forward
0 new messages