Hello all,

I have a quite particular sorting problem with the forEachTiddler
plugin. I am quite new to TiddlyWiki and especially to editing/
modifying/creating any type of code, so please bear with me.

I have tried to search for the answer, but I was encouraged to ask
directly here. Even the front page here states that: "New Users:
Please don't hesitate to post your questions. Elsewhere you are
expected to wade through the archives before posting any questions.
But it's not like that here - just jump in."

On to the problem. I have a set of tiddlers which all contain 3 tags.
These tiddlers are created from form inputs. Tag1 is automatically
created and always common to all these tiddlers. There is a limited
amount of different options for the second tag, it is also
automatically created (e.g. Tag2a, Tag2b, Tag2c, Tag2d). The third tag
is based on user input in the original form, and thus can be basically
anything. It is however expected that over time, there will be many
tiddlers which contain the same third tag. Having the user select the
third tag from a list or such is not a valid option in this case, the
third tag needs to be free for the user to create.

The input form also creates other data in the new tiddler, but I want
to sort these tiddlers based on their tags. I have been trying to use
the forEachTiddler plugin. So far, I have been able to create (usable)
lists of tiddlers that contain "Tag1" and lists of tiddlers which
contain for example both "Tag1" and "Tag2c".

I would now like to create a list of tiddlers which contain "Tag1" and
which are sorted and grouped together by only the third tag. As the
third tag is unknown, and there will be more of them over time, I
cannot use simply tiddler.tags.containsAll(Tag1, Tag3a, Tag3b...).
Instead, I think I should use some type of exclusion. Below is a
pseudo-code example of what I am trying to say:

<<forEachTiddler
 where
 'tiddler.tags.contains("Tag1")'
 sortIntoGroupsBy
 'those.tiddler.tags.ThatAreNot(["Tag2a","Tag2b","Tag2c","Tag2d"])'
>>

http://tiddlywiki.abego-software.de/#[[List%20all%20Tiddlers%2C%20grouped%20by%20Tags]]

The example in the above link is close to what I want. However, I want
the sorting/script to only include tiddlers with Tag1 to begin with,
and for it to ignore all Tag2's in the sorting/grouping process.

It is my educated guess that I must edit this line of the script in
the provided link:
 script
 'function getSortedTagsText(tiddler) {var tags = tiddler.tags; if (!
tags) return ""; tags.sort(); var result = ""; for (var i = 0; i <
tags.length;i++) {result += tags[i]+ " ";} return result;} function
getGroupTitle(tiddler, context) {if (!context.lastGroup ||
context.lastGroup != getSortedTagsText(tiddler)) { context.lastGroup =
getSortedTagsText(tiddler); return "* {{{"+(context.lastGroup?
context.lastGroup:"no tags")+"}}}\n";} else return "";} '

However, I have no idea where to start. My attempts so far, however
gentle or minor, have always resulted in a syntax error.

Thanks in advance for any insight or help with this issue.
-- 
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