I typed too quickly. It is hard to help without access to the data in use.
However, this worked in my tests:
```
<$list
filter="[c_status[incumbent]]:sort:string:caseinsensitive[{!!rank}addsuffix{!!birth_year}]">
<$link to=<<currentTiddler>>> <$view field=birth_year/> <$view
field=title/> <$view field=rank/></$link><br>
</$list>
```
Note the use of {!!rank} to get the rank value.
You will likely get even more answers if you
use https://talk.tiddlywiki.org/ , which is now the primary forum for
TiddlyWiki.
HTH
On Saturday, April 16, 2022 at 1:56:20 PM UTC-7 Harry wrote:
> Hi Mark,
>
> Thanks for the help! I tried to copy your code, but it gives a syntax
> error notice. All my fields used for sorting are numerical values, do I
> still need to treat them as string in the code? (e.g. 1960.02 for
> birth_year, 50 for rank)
>
> What I have now is
>
> ```
> <$list
> filter="[c_status[incumbent]:sort:number[[rank]addsuffix[birth_year]]]">
> <$link to=<<currentTiddler>>><$view field=birth_year/><$view
> field=title/><$view field=rank/></$link><br>
> </$list>
> ````
>
> or
> ```
> <$list
> filter="[c_status[incumbent]:sort:string:caseinsensitive[[rank]addsuffix[birth_year]]">
> <$link to=<<currentTiddler>>><$view field=birth_year/><$view
> field=title/><$view field=rank/></$link><br>
> </$list>
> ```
>
> Neither code seems to work and I'm having some difficulty in reading
> through the SFRP document. Would anyone mind helping me to look more into
> this? Many thanks!
>
> 'Mark S.' via TiddlyWiki <[email protected]> 于2022年4月16日周六
> 10:00写道:
>
>> To sort by multiple fields, you would use the sort filter run prefix
>> <https://tiddlywiki.com/#Sort%20Filter%20Run%20Prefix>.(SFRP) Inside the
>> SFRP, you would use a filter perhaps like:
>>
>> ```
>>
>> :sort:string:caseinsensitive[[c_rank]addsuffix[tenure]addsuffix[birth_year]]
>> ```
>>
>> which would sort by rank, tenure, and birth year. You might need to
>> zero-pad your fields.
>>
>> To create the table, the easiest way is to use standard HTML notation.
>>
>>
>>
>> On Friday, April 15, 2022 at 2:09:56 PM UTC-7 Harry wrote:
>>
>>> Hi,
>>>
>>> I have a question about sort a list by multiple fields. I have a bunch
>>> of entries of persons' bios. Each bio entry has a set of fields associated,
>>> such as birth year, death year, birth date, tenure length etc.
>>>
>>> I want to create a list with some of those persons and sort it by
>>> multiple fields, such as first by tenure length, if same tenure, then sort
>>> by birth year, then death year etc.
>>>
>>> What I currently have is
>>>
>>> <$list filter="[c_status[incumbent]sort[c_rank]]">
>>> </$list>
>>>
>>> This gives me a list that allows me to filter all incumbents but the
>>> list can only be sorted by rank. I want to add multiple fields (e.g. V1,
>>> V2, V3) behind the rank sort but it doesn't work. I'd appreciate it if any
>>> one could share their insights on this.
>>>
>>> My second, maybe more unrealistic goal, is to transform the list to a
>>> table. Its visual would ideally look like this (
>>> https://en.wikipedia.org/wiki/Lists_of_state_leaders_by_age#Top_ten_since_1942),
>>>
>>> i.e. I can put each field value of one entry in different cells of the same
>>> row and the table will update itself
>>>
>>> The code I'm currently using is
>>>
>>> <$list filter="[c_status[incumbent]sort[c_rank]]">
>>> <$link to=<<currentTiddler>>><$view field=birth_year/><$view
>>> field=title/><$view field=birth_month/><$view field=c_rank/></$link><br>
>>>
>>> And the layout is a list of sorted entries with field values crudely
>>> attached at the beginning and the end of each line. Basically I wonder if I
>>> can separate those values into different cells.
>>>
>>> Many thanks!
>>>
>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/3DjVJRjEvxU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/5595838a-ac78-4702-a6ec-92222a8d4bcbn%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/tiddlywiki/5595838a-ac78-4702-a6ec-92222a8d4bcbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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/46fb97ab-aa67-4d6d-a29d-a6c4f378e7ddn%40googlegroups.com.