Important note, the condition fields aren't defined in the current public 
version, so you'd have to add them in to get a working test.

On Tuesday, July 20, 2021 at 9:03:42 AM UTC-5 Soren Bjornstad wrote:

> Tones,
>
> :filter was my first thought, but I couldn't figure out how the data would 
> flow through it. Perhaps I was missing something, looking forward to seeing 
> your version.
>
> If it helps to see the context, have a peek at 
> https://zettelkasten.sorenbjornstad.com/#%24%3A%2Fsib%2Frefexplorer%2FReferenceExplorer.
>  
> The snippet above (or a replacement) would go inside the ref-explorer macro 
> definition.
>
>
> On Tuesday, July 20, 2021 at 8:07:09 AM UTC-5 TW Tones wrote:
>
>> Soren,
>>
>> Its late here but I have done something similar in the past without a 
>> performance hit, and will try and create a solution tomorrow, However I 
>> think the answer best answer may be through the use of a filter run as in 
>> 5.3.23+ however I am sure I succeeded in something similar a few versions 
>> ago.
>>
>> No need for reduce and accumulators I think.
>>
>> Regards
>> Tones
>>
>> On Tuesday, 20 July 2021 at 13:09:18 UTC+10 Soren Bjornstad wrote:
>>
>>> Hi all,
>>>
>>> I want to determine what tabs of the Reference Explorer in my 
>>> Zettelkasten to show on a template, such that if there aren't any results 
>>> on that tab, the tab doesn't appear at all. The results of the tab are 
>>> produced based on a filter (of course), so I figured I would also determine 
>>> whether the tab appears by running a filter. The filter is stored in a 
>>> field in the tab tiddler.
>>>
>>> That is, I have a series of tiddlers with a certain tag (say *Tab*), 
>>> and each of these tiddlers contains a filter in some field (say 
>>> *condition*). For each Tiddler tagged Tab, if and only if the filter 
>>> Tiddler!!condition, run with the current tiddler as input, has more than 
>>> zero results, I want to display the tab.
>>>
>>> I came up with the following:
>>>
>>> <$set name="tabList" value={{{ [tag[Tab]] 
>>> :reduce[<storyTiddler>subfilter{!!condition}then<currentTiddler>addprefix[ 
>>> ]addprefix<accumulator>] }}}>
>>>     <$macrocall $name="tabs" tabsList=<<tabList>>/>
>>> </$set>
>>>
>>> This produces the correct result (well, as long as there are no spaces 
>>> in the titles of the tiddlers tagged *Tab*; I'm OK assuming that since 
>>> there indeed aren't any). The problem is that it is horrendously slow to 
>>> run all these filters. On my dev machine it is tolerable, but this is a 
>>> machine specced for serious processing power. On my MacBook Air it now 
>>> takes 1–2 seconds to open a new tiddler, even without anything currently 
>>> open!
>>>
>>> Probably I am just asking TW to do too much on the fly here, but before 
>>> I start rethinking the project too hard, can anyone think of obvious 
>>> optimizations I might be missing here? The filters involved are moderately 
>>> complex (the basic pattern for each is to gather together links[], 
>>> backlinks[], and tagging[] for the story tiddler, then filter some things 
>>> out of that using + and !*operator*[]'s).
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e5654fb8-89c1-4570-8314-0eb6173221f2n%40googlegroups.com.

Reply via email to