How to listing indexes/values for multiple data tiddlers?

102 views
Skip to first unread message

barro...@gmail.com

unread,
Apr 6, 2019, 1:28:45 AM4/6/19
to tiddl...@googlegroups.com
EDIT: Sample tiddler attached

The question:  How to display values of indexes in a single list indexes/values for multiple data tiddlers.  Details below.

What I'm attempting to do is display indexes/values for a single list displaying indexes/values from multiple data tiddlers using a filter run to select the data tiddlers.  The data tiddlers are all taggged "dataset" and are spread through different groups (different monsters) and each group has several different data tiddlers that have different suffixes (like monsters mobs/hau used in the code example below).  These suffixes are used in all the groups, so there would be 10 data tiddlers with the suffix mobs/hau.

First part of code is the data tiddler suffix selection for the filter run.  Only one select is shown.  It selects the suffix, in this case mobs/hau.  It passes the suffix value to a filter run in the display table.

Select a monster category <$select field='filter-field2'>
<option value='mobs/hau'>Monsters and their haunts</option></$select>

<$set name="data" value={{!!filter-field2}}>
<table style=""><tr><th>Monster (index title)</th><th>Haunt (value)</th></tr><$list filter="[tag[#dataset]suffix<data>indexes[all]]">
<tr><td>{{!!title}}</td><td><$transclude tiddler=<<data>> index=<<currentTiddler>>/></td></tr></$list></table></$set>



The standard code for the display table works for displaying indexes/values for single data tiddlers but when I pass a filter run (to list multiple data tiddlers) to it, it will display index titles but not the values.  I figure it's the transclude widget which uses a tiddler name instead of a filter parameter.

I probably should be using the tiddler widget instead of the transclude widget?  I've seen others using it for data tiddlers.
exampletiddlers.json

Jed Carty

unread,
Apr 6, 2019, 4:10:59 AM4/6/19
to TiddlyWiki
First because I don't think I can explain it in text, here is simplified annotated code:


<$set name="data" value={{!!filter-field2}}> // <-- the variable data is a suffix we want
<$list filter="[tag[#dataset]suffix
<data>indexes[all]]"> // <-- get a list of all indexes in all tiddlers with the suffix
    {{!!title}} // <-- This title is the current title returned by the list, so it is an index name from the list above
    <$transclude tiddler=<
<data>> index=<<currentTiddler>>/> // <-- The problem is here, currentTiddler is the current item in the list, which is the same as {{!!title}} above and tiddler=<<data>> tries to go to the tiddler named 'mobs/hau' not a tiddler with that suffix.
</$list>
</$set>

so the line is in the transclude widget, it is trying to transclude from a tiddler called mob/hau, not the data tiddler you want. Without some example tiddlers I don't think I can do more than point out where I think the problem is.

barro...@gmail.com

unread,
Apr 6, 2019, 5:50:09 AM4/6/19
to TiddlyWiki
First because I don't think I can explain it in text, here is simplified annotated code:


That will work just as well as an explanation-- will give me something to experiment will to see how it works.  The same way I got the filter run expression to work between the select and display table -- kept trying different ways till one got me the results I was hoping for-- love TW's preview pane.  I greatly appreciate your assistance.

barro...@gmail.com

unread,
Apr 6, 2019, 6:09:35 AM4/6/19
to TiddlyWiki
>> Without some example tiddlers I don't think I can do more than point out where I think the problem is.

You mean the data tiddlers?  I could provide altered copies (the originals have proprietary info but this is important enough for the effort) in a json tid which would have shorter data tiddlers and the display tiddler that the code from above came from.  If you're willing to toy with the actual tid's, I will definitely take you up on that generosity.

barro...@gmail.com

unread,
Apr 6, 2019, 9:53:46 AM4/6/19
to TiddlyWiki
A json tiddler with the page with the code from above and 15 small data tiddlers so show what I was attempting.  There's some extra coding and display elements on the main page that are for assisting with troubleshooting, it should make sense I hope.
exampletiddlers.json
Reply all
Reply to author
Forward
0 new messages