Hi everyone,
I'm working on a custom reference explorer for my wiki using TiddlyTables. It inspects links, tags, fields, and so on to generate a rich display of connected tiddlers categorized by their type.
I'd like to include a column that identifies the type of link (e.g., hardlinked, backlinked, listed in a field, tagged, etc.). I don't want nested tables -- they should all be listed in the same table, but one of the columns categorizes the elements by link type. TiddlyTables doesn't appear to have any built-in features to accomplish this kind of "pivot" operation.
Here's what I managed to do last night. I first created a filter that included all the types of links for certain tags:
[<storyTiddler>backlinks[]] [<storyTiddler>links[]] [<storyTiddler>tagging[]] +[!tag[Source]!tag[Publication]!tag[Place]!tag[Meta]!tag[PAO]sort[]]
I then added a pseudo-field called "linktype" to my table. This field doesn't actually exist on any tiddlers (and it can't, because it's not a property of the tiddler itself but depends on the relationship between it and the story tiddler at the time the table is rendered). I then created a custom template for this field, which looks something like this:
<td>
<$list filter="[<currentRecord>] -[<storyTiddler>links[]] +[else[Link]] -[<storyTiddler>backlinks[]] +[else[Backlink]] -[<storyTiddler>tagging[]] +[else[Tagged]]">
<<currentTiddler>>
</$list>
</td>
So basically, all of the relevant types of links are pulled together in one list, and then when the empty "field" linktype is rendered for each record, the display template repeatedly attempts to make the list containing the single element currentRecord empty by subtracting the lists of different link types, and outputs the link type as a string when it succeeds (note that something might be more than one type, in which case the first type listed takes precedence, links > backlinks > tag).
The main problem with this approach is that you cannot sort by the link type field (because the field has no content, so all elements have the same sort key). I'd like to allow the user to filter/sort based on the link type. Ideally, I would also like to list multiple types if the tiddler is related in multiple ways (e.g., tagged and backlinked). I could do this in theory with the current method, but by the time I'm done adding link types, the filter would be a mile long with all the combinations.
Are there any TiddlyTables features or other approaches I'm missing here that might let me address these issues without overcomplicating things? Thanks in advance for any suggestions!