Summary Matrix Table

215 views
Skip to first unread message

Stuart Amor

unread,
Mar 4, 2016, 1:24:21 AM3/4/16
to TiddlyWiki
I am trying to use tiddlywiki to create room datasheets. I have each room created as it's own tiddler and labelled "rooms".  The within each room tiddler I tag the plant in the room, which likes to a tiddler labelled "plant". Let me give you an example - I have two room tiddlers called "kitchen" and "bathroom" which both tag the plant tag called "taps" but only the bathroom has the tag "toilet". 

I want to create a dynamic summary matrix that automatically grows when I add another room or plant tiddler. The matrix needs to list all the rooms as columns and have all the plant items as rows. If a room has that plant tag a X is inserted in the matrix. 

.           Kitchen.       Bathroom 
Taps.         X.                   X
Toilet.                               X

Any suggestions would be great

Hegart Dmishiv

unread,
Mar 4, 2016, 2:21:16 AM3/4/16
to tiddl...@googlegroups.com
Hi Stuart,

You might like to have a look at the Spreadsheet as Wiki Models exercise we did in the {{DesignWrite}} course recently. It creates a matrix of inter-related tiddlers from a spreadsheet.

Hegart.

Stuart Amor

unread,
Mar 4, 2016, 2:29:28 AM3/4/16
to TiddlyWiki
Thank you, could you provide me with a link to the material?

Hegart Dmishiv

unread,
Mar 4, 2016, 3:03:40 AM3/4/16
to TiddlyWiki
Sorry, link above fixed, and repeated here. Spreadsheet as Wiki Models. Not sure what happened there, but I'll blame Google anyway. ;-)

Jed Carty

unread,
Mar 4, 2016, 3:07:01 AM3/4/16
to TiddlyWiki
The dynamic tables I made may help
http://inmysocks.tiddlyspot.com/#ColumnTable%20Macro

Stuart Amor

unread,
Mar 14, 2016, 3:23:12 PM3/14/16
to TiddlyWiki
Thank you Jed, I really thought you had the answer. That is until I tried to get carried away and entered:

<<ColumnTable '[tag[Location]]' '[tag[Furniture]]'>>

Even though I am using a tag list for both column and rows the table wizard appeared to handle the results well within the field portion of the tiddler. That is, until I saved and reloaded it. Field names appear to be limited to one word and just lowercase. Which means "Gold Taps" becomes just "gold" and "GoldTaps" turns to "goldtaps".

Might have to be longhand after all

Jed Carty

unread,
Mar 15, 2016, 5:11:29 AM3/15/16
to TiddlyWiki
Yes, the field name limits are part of tiddlywiki so if you have rows or columns that don't fit that it won't work. I have been thinking about ways to get around this for the tables but so far without success. I will let you know if I come up with something.

Stuart Amor

unread,
Mar 15, 2016, 2:00:28 PM3/15/16
to TiddlyWiki
I have found a solution in another thread that works well, but I need a little help with it.  I have gone for the following:

Enter<table style="width:100%">
<tr>
   <td style="width:1%">&nbsp;</td>
   <$list filter="[tag[Location]sort[]]" variable="col">
      <td style="width:1%"><$link to=<<col>>>''<<col>>''</$link></td>
   </$list>
</tr>
<$list filter="[tag[Furniture]sort[]]" variable="row">
   <tr>
      <td style="width:1%"><$link to=<<row>>>''<<row>>''</$link></td>
      <$list filter="[tag[Location]sort[]]" variable="col">
         <td style="width:1%">
            <$transclude tiddler=<<col>> index=<<row>>>-</$transclude>
         </td>
      </$list>
   </tr>
</$list>
</table>

I am then using a application/x-tiddler-dictionary type tiddler for each room, eg Bathroom-Data, containing the following:

Taps: Gold
Sink: Double Basin

My only problem is that using application/x-tiddler-dictionary limits the presentation options in Bathroom-Data.  So I started creating a cover tiddler with the same room name minus the "-Data" suffix, for example tiddler "Bathrooom" contains:

\define distance(roomdata)
<table>
<$list filter="[[Bathroom-Data]indexes[]]">
<tr>
<td><$link><$view field="title"/></$link></td>
<td><$view tiddler="Bathroom-Data" index={{!!title}}/></td>
</tr>
</$list>
</table>
\end

<<distance event:"roomdata">>

I am hoping its a simple question, but how can I modify my matrix code to list present links to the non-Data version of the tiddler at the top, but pull from the "-Data" version of the tiddler for the cells?


Jed Carty

unread,
Mar 16, 2016, 5:13:48 AM3/16/16
to TiddlyWiki
That looks good. I may be able to use that to make a version of the table macros that uses data tiddlers and avoids the problems with spaces and capitalization in names.


You have, perhaps unintentionally, set up a nice clean solution to your problem.
You want to use the removesuffix filter.

Try something like this:

Enter<table style="width:100%">
<tr>
   <td style="width:1%">&nbsp;</td>
   <$list filter="[tag[Location]sort[]]" variable="col">
<$list filter='[<currentTiddler>removesuffix[-Data]]' variable=CoverTiddler>
      <td style="width:1%"><$link to=<<CoverTiddler>>>''<<col>>''</$link></td>
   </$list>
</$list>
</tr>
<$list filter="[tag[Furniture]sort[]]" variable="row">
<$list filter='[<currentTiddler>removesuffix[-Data]]' variable=CoverTiddler>
   <tr>
      <td style="width:1%"><$link to=<<CoverTiddler>>>''<<row>>''</$link></td>
      <$list filter="[tag[Location]sort[]]" variable="col">
         <td style="width:1%">
            <$transclude tiddler=<<col>> index=<<row>>>-</$transclude>
         </td>
      </$list>
   </tr>
</$list>
</$list>
</table>

The add/remove prefix/suffix filters are very powerful but not always obvious.
Reply all
Reply to author
Forward
0 new messages