Hi Tony,
I'm try to apply this solution in a fashion using a template.
Let's suppose I have two tags called "Topic1" and "Topic2". I have a bunch
of tiddlers tagged with one or both of these tags. On the Topic1 tiddler, I
want to make a list of all the tiddlers tagged Topic1 sorted by two fields.
I've been able to do most of this with a nice template
template/FilteredTagTemplate:
<$list filter="[tag<currentTiddler>sort[speaker]]">
<$link to=<<currentTiddler>>><$view field=speaker/> - <$view
field=title/></$link>
{{||$:/core/ui/ViewTemplate/tags}}
</$list>
Then in the Topic1 tiddler:
{{||template/FilteredTagTemplate}}
Everything is great except that I want to sort by Speaker and Title.
I tried using your example in my template/FilteredTagTemplate, but it takes
minutes to display as it is returning every tiddler in my file.
So I've been trying something like this:
template/FilteredTagTemplate:
\define tiddlerset-filter() [tag[<currentTiddler>]]
<$list filter=
"[subfilter<tiddlerset-filter>each[speaker]get[speaker]sort[]]" variable=
aspeaker>
<$list filter="[subfilter<tiddlerset-filter>speaker<aspeaker>sort[]]">
<$link to=<<currentTiddler>>><$view field=speaker/> - <$view field=
title/></$link>
{{||$:/core/ui/ViewTemplate/tags}}
</$list>
</$list>
Topic1:
{{||template/FilteredTagTemplate}}
No results displayed.
I've tried a number of different ways to get the subfilter to be just the
tiddlers marked with the title of the current tiddler, all to no avail. Any
suggestions would be greatly appreciated.
On Wednesday, December 11, 2019 at 8:34:57 PM UTC-5, TonyM wrote:
>
> Mohammad,
>
> Sorry for the delay in a response.
>
> I used all tiddlers to include only the subset of what would be most
> likely in a query of state and region tiddlers. This acts to limit the
> default.
>
> I have no objection to your suggestion, however since this part of the
> filter needs to be the same at all levels of the nested lists, perhaps
> abstracting this to a subfilter makes more sense since you need only edit
> in one place.
>
> Perhaps a better approach would be a subfilter*, (This code untested
> against data)*
> \define tiddlerset-filter() [all[]]
> <$list fiter="[subfilter<tiddlerset-filter>each[state]get[state]sort[]]"
> variable=state>
> <$list
> fiter="[subfilter<tiddlerset-filter>state<state>each[region]get[region]sort[]]"
>
> variable=region>
> <$list fiter="[subfilter<tiddlerset-filter>state<state>region
> <region>sort[]]">
> <<currentTiddler>>
> </$list>
> </$list>
> </$list>
>
> Regards
> Tony
>
> On Monday, December 9, 2019 at 5:44:20 AM UTC+11, Mohammad wrote:
>>
>>
>>
>> On Saturday, December 7, 2019 at 8:42:44 AM UTC+3:30, TonyM wrote:
>>>
>>> I do not mean to sound competitive, but all you need is .nested lists
>>>
>>> <$list fiter="[all[tiddlers]each[state]get[state]sort[]]" variable=state>
>>> <$list fiter="[all[tiddlers]state<state>each[region]get[region]sort[]]"
>>> variable=region>
>>> <$list fiter="[all[tiddlers]state<state>region<region>sort[]]">
>>> <<currentTiddler>>
>>> </$list>
>>> </$list>
>>> </$list>
>>> gives a list sorted by state then region then tiddler title
>>> not tested against data
>>>
>>> note the groups state and region use "each" and the inner list only
>>> lists those with the same state<state> and region<region> at a time
>>>
>>> to keep it tidy i use the same name as the field as the variable name
>>> generated by the each lists.
>>>
>>> state<state> means list all tiddlers with the state field = the value in
>>> the `<<state>> variable.
>>>
>>> you could wrap the whole thing or make it more levels deep however a new
>>> outer filter may need every filter to be updated. See how every list filter
>>> starts with all[tiddlers] a fresh, so if you want to operate on all
>>> tiddlers this is fine but only with tag[a] would need to read
>>> [all[tiddlers]tag[a] to each filter.
>>>
>>
>> What do you think if we omit the all[tiddlers]. I think the input of
>> every filter is all[tiddlers] or all[tiddlers+shadows] so it should not
>> affect the performance in this case! What do you think?
>>
>>>
>>>
>>> Regards
>>> Tony
>>>
>>> On Saturday, December 7, 2019 at 3:47:14 PM UTC+11, Mark S. wrote:
>>>>
>>>>
>>>> There are different approaches. The easiest would be to make a button
>>>> that, when pressed, populates a fourth field that can then be sorted.
>>>>
>>>> Here's an approach that doesn't require two steps, but it does assume
>>>> that "@@" is reserved:
>>>>
>>>> \define sortus()
>>>> <$vars lb="[[" rb="]]">
>>>> <$list filter="[has[fa]]">
>>>> <$list
>>>> filter="[<currentTiddler>addprefix[@@]addprefix{!!fc}addprefix{!!fb}addprefix{!!fa}addprefix<lb>addsuffix<rb>]"/>
>>>> </$list>
>>>> </$vars>
>>>> \end
>>>>
>>>> <$wikify text=<<sortus>> name="ready2sort">
>>>> <$list filter="[enlist<ready2sort>sort[]]" variable="sorted">
>>>> <$list filter="[<sorted>split[@@]rest[]]"/>
>>>> </$list>
>>>> </$wikify>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Friday, December 6, 2019 at 7:53:03 PM UTC-8, Mohammad wrote:
>>>>>
>>>>> Assume you have a bunch of tiddlers
>>>>>
>>>>> - all tagged with data
>>>>> - all have three fields fa, fb, fc
>>>>>
>>>>>
>>>>> How one can produce a list of tiddlers where they are
>>>>>
>>>>> - sorted first by fa
>>>>> - then by field fb
>>>>> - then by field fc
>>>>>
>>>>>
>>>>> This means to keep the multiple sort order!
>>>>>
>>>>> --Mohammad
>>>>>
>>>>
--
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/0be0f3ce-44b3-4609-aff6-9816dcfde2a1%40googlegroups.com.