Tweak/Button for "Replace StoryRiver open Tiddlers with all Filter Search Results"

Hello,

I looked around a bit here and online and wasn’t having much luck but I have to assume someone has made a quick that can do this;

I would like a small addtl button on the Advanced Search > Filter tab that will replace the current Story River (including the advanced search tiddler itself will be replaced) with all the currently show results of the filter. I’m wanting to use this in conjunction with @EricShulman TiddlyTools/Search/SaveFilter so I can save and return to pre-defiend story river states (workspaces)

I’m aware of the ‘views’ tiddlywiki-plugins plugin but I think just adding one addtl button to advanced search > filters for a similar functionality is a bit sleeker.

Just let me know, thanks!

I ended up finding this tweak:

https://groups.google.com/forum/?oldui=1#!topic/tiddlywiki/jef0YHGMwp8

Seems to do what I was wanting, just need to tweak it to close all other currently-open story river Tiddlers as well.

Your recursion is missing a base case!

In other words, the link you included in your solution is right back to this topic. Did you have a link to somewhere else you meant to share?

The reason I would not have much use for the tool discussed here, and I would not wish to open a large number of tiddlers, only the results of a small number in which case I am happy to click each tiddler title in the results list to open them.

Note ctrl-click opens the tiddler below allowing you continue to click more titles.

A more general solution where one can configure one or more actions to perform on the advanced search list may be more helpful. In this case close all (I use close others button) and navigate to each tiddler, would meet the Original request but allow other actions to be applied.

This illustrates some ideas I have being slowly trying to realise and that is collecting actions that apply to a title or list of all titles, just as we collect filters in the advanced search filters tab drop down. But unlike filters we often want to modify a default to add a particular tags, modify a particular field or value.

  • Thus perhaps the ability for the user to craft the actions and save them for reuse makes sense?

A quick look at the filters tag $:/tags/Filter indicates the filter tiddlers text field is empty. Perhaps we could add actions to the text field, and if the text field contains actions, have a button appear to apply such actions to each tiddler in the search results.

  • Just once instance of this would address the Topics requirement.
  • Perhaps a separate and independent drop down list.

While opening the general Filter search results in the StoryRiver might not be useful for very large lists to tiddlers, it could still be useful for saving the results of “[list[$:/StoryList]] -$:/AdvancedSearch” to create and re-load “saved stories”. How many tiddlers is “too many” depends on the use-case.

When a filter is created and saved using my TiddlyTools/Search/Filters “FilterMaker” interface, I use the filter tiddler’s text field to store the individual FilterMaker input parameters (as a JSON index) so that if you edit the filter again using the FilterMaker it can reload the stored input parameters back to the FilterMaker interface.

-e

1 Like

Perhaps then its safer to add an actions-on-items field with a macro or transclusion to the separate action tiddler, also allowing reuse on multiple filter tiddlers?

Yeah I mangled the link, it’s fixed now.

1 Like

Give this a try: TiddlyTools/Search/FilterActions

It adds a “factory” button (:factory:) to the $:/AdvancedSearch > Filter tab. The TiddlyTools/Search/FilterActions tiddler is tagged with $:/tags/AdvancedSearch/FilterButton, and contains:

<$set name=acts filter="[tag[$:/tags/FilterActions]]">
<$list filter="[<acts>!match[]then{$:/temp/advancedsearch}!match[]]" variable=filt>
<$set name=tids filter=<<filt>>>
<$let popid=<<qualify "$:/state/popup/filteractions">>>
@@font-size:125%;<$button popup=<<popid>> class=tc-btn-invisible tooltip={{!!caption}}>&#x1F3ED;</$button>@@
<$reveal state=<<popid>> type=popup class=tc-block-dropdown style="padding:0.5em;" position=belowleft>
''{{!!caption}}''
<$list filter="[enlist<acts>]">
	<$button class="tc-button tt-button" style="display:block;width:100%;margin:0.25em 0;" actions={{!!text}}>
		<$view field=caption><$view field=title/></$view>
	</$button>
</$list>

This button shows a popup with a list of tiddlers tagged with $:/tags/FilterActions, each of which contains wikitext and action widgets to perform on the list of tiddlers that were found using $:/AdvancedSearch > Filter.

Within each FilterActions tiddler, you can refer to <<filt>> to get the search filter syntax, and <<tids>> to get the list of matching tiddlers.

For example, the following will display a message showing the current filter (filt), the number of matching tiddlers found ([enlist<tids>count[]]), and the list of tiddler titles ([enlist<tids>]):

<$let lf={{{ [charcode[10]] }}}>
<$action-confirm $message={{{ [<filt>] [enlist<tids>count[]addsuffix[ matching tiddlers]] [enlist<tids>] +[join<lf>] }}}/>

and this simple one-line wikiscript will “replace StoryRiver open Tiddlers with all Filter Search Results”:

<$action-setfield $tiddler="$:/StoryList" list=<<tids>>/>

enjoy,
-e

2 Likes

Whoa! This is extremely flexible and lean!

Thank you for showing me the “Tiddly” approach of doing things; I still haven’t taken the time to hunker down and really learn Wikitext, but tweaks like this always remind me I really should do so.

Thanks again.

-Xyvir

Cool!

In case anyone else runs into this puzzlement:

No special button shows up after just importing the TiddlyTools/Search/FilterActions… .

The button with factory icon appears only once you’ve also got at least one tiddler carrying the tag $:/tags/FilterActions. Which might make sense…

But @EricShulman if the factory button renders (or renders at half-opacity or whatever), and clicking it yields “No FilterActions are yet defined” (or whatever), that might help avoid some head-scratching.

1 Like

Thanks for the good feedback!

I’ve just updated TiddlyTools/Search/FilterActions so that it will always display, even if there are no tiddlers tagged with $:/tags/FilterActions. To address this situation, I’ve added an “add new FilterAction” button to the bottom of the popup. Clicking this button edits an auto-numbered “New FilterAction” tiddler, that is automatically tagged with $:/tags/FilterActions.

-e

3 Likes