I've done some searches of this group and played around with examples
and have *almost* got this working but I'm missing something.

I have a custom field called subtopic. I want to build a tiddler that
has all of the notes under it grouped by the subtopic field. The code
below works....unless there is no subtopic. If there is even 1 tiddler
with no subtopic, all of them get grouped under 'no subtopic'
Seems it has to do with my sortBy but I can't seem to get it right.
Ideas?

Scott

-----

<<forEachTiddler
     where 'tiddler != context.inTiddler &&
            tiddler.tags.contains(context.inTiddler.title)'
sortBy 'GroupTitle = store.getValue(tiddler,"subtopic")'
script 'function getGroupTitle(tiddler, context) {
    if ( (context.lastGroup != "no subtopics") && (!context.lastGroup
|| context.lastGroup != store.getValue(tiddler,"subtopic")))
{
        context.lastGroup = store.getValue(tiddler,"subtopic");
        if (!context.lastGroup || context.lastGroup == "")
context.lastGroup = "no subtopics";
        return "!! "+context.lastGroup+"\n";
    } else return "";}'
write
'getGroupTitle(tiddler, context)+"** [["+tiddler.title+"]]\n"'
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to