Mario, Eric,
Thanks for the quick reply, you gave me hope.
Eric's answer seems closer to what I need, since I want to sort by
field value not by tag. Typically I have a field named 'time' with
possible value say 'early', 'late','never' and I want all tiddlers
where time==late.
However I cannot make the above script to work ! I get the following
message

TypeError: store.displayTiddlers is not a function

The script seems right though ...
(I have installed the InlineJavascriptPlugin and checked that it is
present).

Scalpa

(PS : I got disconnected from Google Groups when I first posted this,
so I assumed it didn't go through; if it did I'm sorry for the double
post ; erase at will)


On 13 fév, 12:30, Eric Shulman <[email protected]> wrote:
> > I’ve been trying to open multiple tiddlers as well and following
> > closely the hints here (being a newbie). But I can’t get TiddlyWiki to
> > do what I really want: open a dynamically generated list of tiddlers,
> > typically gotten from a field = value request.
>
> > What I can do, using the OpenStory macro or story.display directly
> > is :
> > 1) open the tiddlers listed in another tiddler, so a static call ;
> > 2) open all tiddlers with a given tag ;
> > 3) generate a list of tiddlers with prescribed values for given
> > field(s), using ForEachTiddler.
>
> > But I can’t mix the two. If I try OpenStory on the tiddler generated
> > by ForEachTiddler, I get no answer at all. On the other hand
> > story.display shows a list of tiddlers based on the *source* text of
> > my dynamic tiddler  :-(
>
> <<forEachTiddler>> dynamically generates and shows content.  However,
> the output from <<forEachTiddler>> isn't actually stored as data
> anywhere.  It is simply rendered into the story column when the
> tiddler is displayed.  Thus, it is not available for use by
> <<openStory>> [1] which needs *data* contained in the source text of a
> stored tiddler.
>
> Fortunately, what you are trying to do is actually very
> straightforward to write as direct, inline javascript code [2] to
> perform the entire process using standard TW core functions,
> store.forEachTiddler(...), store.getValue(...), and
> store.displayTiddlers(...)
>
> <script>
>    var titles=[];
>    store.forEachTiddler(function(title,tiddler){
>       var val=store.getValue(title,'fieldname');
>       if (val==undefined) return; // no field... ignore this tiddler
>       titles.pushUnique(val);
>    });
>    store.displayTiddlers(null,titles);
> </script>
>
> note: the above code assumes that for any given tiddler, the
> 'fieldname' in question contains a single tiddler title to be used.
> However, if we were to suppose that the field contains a space-
> separated *list* of tiddler titles to be used, then instead of simply:
>       titles.push(val);
> you could write something like:
>       val.readBracketedList().map(function(title)
> {titles.pushUnique(title);});
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools / ELS Design Studios
> refs:
> [1]http://www.TiddlyTools.com/#StorySaverPlugin
> [2]http://www.TiddlyTools.com/#InlineJavascriptPlugin

-- 
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