Good solution!
Thanks Tony!
On Thursday, December 12, 2019 at 5:04:57 AM UTC+3:30, 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/8f2fe014-6a9f-4b96-83a7-c9ba3a2e7dd9%40googlegroups.com.