Motivation
In some occasions it is desirable to sort a formatted search by more than one criteria, such as fist by parent, then by formfield Title.
Description and Documentation
Allow
sort
parameter to have a comma-space delimited list of sort tokens, such as
sort="parent, formfield(Title)"
Related, the
reverse
parameter also supports a comma-space delimited list to have control over reverse sorting per sort token.
Example:
sort="formfield(Title), formfield(Due Date)" reverse="off, on"
Examples
1. Simple search format:
%SEARCH{
"something"
sort="parent, formfield(Title)"
nonoise="on"
format="| [[$topic][$topictitle]] | $summary |"
}%
2. Group topics visually by parent topic:
This can be done by adding an extra table row with parent topic whenever the parent changes.
%SEARCH{
"something"
sort="parent, formfield(Title)"
nonoise="on"
format="$percntCALCULATE{$IF($EXACT($parent, $GET(parent)), , $SET(parent, $parent)| [[$parent]]: ||$CHAR(10))}$percnt| $percntICON{dot_ur}$percnt [[$topic][$topictitle]] | $summary |"
}%
Impact
Implementation
--
Contributors: Peter Thoeny - 2013-11-21
Discussion
Suggestion by
SteveCooper at
KampalaReleaseMeeting2013x11x21: Allow reverse option per sort token, not one reverse for all. I updated above spec with this suggestion.
--
Peter Thoeny - 2013-11-22
This feature is now accepted by 7 day feedback period.
I'll implement in
SVN trunk and 6.0 release. I think it warrants adding this to the next 6.0 patch release because it is useful, safe and transparent.
--
Peter Thoeny - 2013-11-28
This is now in
SVN trunk and 6.0 release.
--
Peter Thoeny - 2013-11-29