On Friday, February 28, 2014 8:00:06 AM UTC-8, John Kerr wrote:
>
> Is there a way to have a simple 'ForEachTiddler' query such as the
> following prompt me for the search string.
> <<forEachTiddler
> where
> 'tiddler.text.contains("bf20140228")'
> >>
>
I would like to place a link to a tiddler called "BringForwardList" in the
> "MainMenu" then be prompted for the date string to pass to the
> 'ForEachTiddler' statement to generate the list which I could either print
> or work with interactively within TiddlyWiki
>
Add to [[MainMenu]]:
----------------
<html><a href="javascript:;" onclick="
var t=prompt('Enter search text',''); if (!t) return;
config.extensions.customSearchValue=t;
story.displayTiddler(null,'BringForwardList');
story.refreshTiddler('BringForwardList',null,true);
">BringForwardList</a></html>
----------------
This creates a link that, when clicked, prompts for input. If non-blank
input is entered, the value is then stored internally in
"config.extensions" (a 'holding bin' provided by the TWCore to keep any
extra variables created by customizations). Calls to
story.displayTiddler() and story.refreshTiddler() ensure that the
"BringForwardList" tiddler is opened in the story column, and that it's
contents are up-to-date.
Then, create [[BringForwardList]], containing:
----------------
Search results for: "<<message extensions.customSearchValue>>"
<<forEachTiddler
where 'tiddler.text.contains(config.extensions.customSearchValue)'
write '"* [["+tiddler.title+"]]\n"'
>>
----------------
The <<message>> macro is used to *display* the search text above the
results, followed by the <<forEachTiddler>> macro, using the stored search
text in the "where" clause. For this example, I used a simple "write"
clause that just outputs the matched tiddler titles as bulleted links.
That should do it. Let me know how it goes...
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://TiddlyTools.github.com/fundraising.html#MakeADonation
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.