⇤ ← Revision 1 as of 2008-10-08 15:48:42
Size: 4215
Comment:
|
← Revision 2 as of 2008-10-08 15:55:08 ⇥
Size: 4247
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
TableOfContents | <<TableOfContents>> |
Line 4: | Line 4: |
||'''First''' ||'''Second''' ||'''Third''' || ||A ||2,000,000 ||zebra || ||C ||1 ||123 || ||b ||2 ||word || ||d ||30 ||{{{word}}} || ||A ||2 ||Wordy || ||B ||4.2 ||23 || ||A ||2 ||'''word''' || |
||'''First''' ||'''Second''' ||'''Third''' || ||A ||2,000,000 ||zebra || ||C ||1 ||123 || ||b ||2 ||word || ||d ||30 ||{{{word}}} || ||A ||2 ||Wordy || ||B ||4.2 ||23 || ||A ||2 ||'''word''' || |
Line 15: | Line 14: |
{{{[[SortBy(SortByTest, 1, 1, nosort)]]}}} | {{{<<SortBy(SortByTest, 1, 1, nosort)>>}}} |
Line 17: | Line 16: |
[[<<SortBy(SortByTest, 1, 1, nosort)>>]] | <<SortBy(SortByTest, 1, 1, nosort)>> |
Line 19: | Line 18: |
This simply includes the first table on the source page at this point in the page containing the macro. Rows are in the same order as the original table. | This simply includes the first table on the source page at this point in the page containing the macro. Rows are in the same order as the original table. |
Line 22: | Line 22: |
{{{[[SortBy(SortByTest, 1, 1, reversenosort)]]}}} | {{{<<SortBy(SortByTest, 1, 1, reversenosort)>>}}} |
Line 24: | Line 24: |
[[SortBy(SortByTest, 1, 1, reversenosort)]] | <<SortBy(SortByTest, 1, 1, reversenosort)>> |
Line 26: | Line 26: |
Similar to the previous example, but now all rows except the one header row are in reverse order. | Similar to the previous example, but now all rows except the one header row are in reverse order. |
Line 29: | Line 30: |
{{{[[SortBy(SortByTest, 1, 1, alpha)]]}}} | {{{<<SortBy(SortByTest, 1, 1, alpha)>>}}} |
Line 31: | Line 32: |
[[SortBy(SortByTest, 1, 1, alpha)]] | <<SortBy(SortByTest, 1, 1, alpha)>> |
Line 33: | Line 34: |
In alphabetical order all uppercase letters are sorted before lowercase letters. | In alphabetical order all uppercase letters are sorted before lowercase letters. |
Line 36: | Line 38: |
{{{[[SortBy(SortByTest, 1, 1, reversealpha)]]}}} | {{{<<SortBy(SortByTest, 1, 1, reversealpha)>>}}} |
Line 38: | Line 40: |
[[SortBy(SortByTest, 1, 1, reversealpha)]] | <<SortBy(SortByTest, 1, 1, reversealpha)>> |
Line 40: | Line 42: |
Prepending 'reverse' to the sort-type changes the order from ascending to descending. | Prepending 'reverse' to the sort-type changes the order from ascending to descending. |
Line 43: | Line 46: |
{{{[[SortBy(SortByTest, 1, 1, nocase)]]}}} | {{{<<SortBy(SortByTest, 1, 1, nocase)>>}}} |
Line 45: | Line 48: |
[[SortBy(SortByTest, 1, 1, nocase)]] | <<SortBy(SortByTest, 1, 1, nocase)>> |
Line 47: | Line 50: |
Now 'B' and 'b' are considered equal, and are presented in the order they appear in the original table. | Now 'B' and 'b' are considered equal, and are presented in the order they appear in the original table. |
Line 50: | Line 54: |
{{{[[SortBy(SortByTest, 1, 2, number)]]}}} | {{{<<SortBy(SortByTest, 1, 2, number)>>}}} |
Line 52: | Line 56: |
[[SortBy(SortByTest, 1, 2, number)]] | <<SortBy(SortByTest, 1, 2, number)>> |
Line 54: | Line 58: |
As you would expect, 30 comes before 2,000,000. Commas are ignored for sorting. Integers and floating point can both be used, and they sort correctly. | As you would expect, 30 comes before 2,000,000. Commas are ignored for sorting. Integers and floating point can both be used, and they sort correctly. |
Line 57: | Line 63: |
{{{[[SortBy(SortByTest, 1, 2, alpha)]]}}} | {{{<<SortBy(SortByTest, 1, 2, alpha)>>}}} |
Line 59: | Line 65: |
[[SortBy(SortByTest, 1, 2, alpha)]] | <<SortBy(SortByTest, 1, 2, alpha)>> |
Line 64: | Line 70: |
{{{[[SortBy(SortByTest, 1, 2, reversenumber)]]}}} | {{{<<SortBy(SortByTest, 1, 2, reversenumber)>>}}} |
Line 66: | Line 72: |
[[SortBy(SortByTest, 1, 2, reversenumber)]] | <<SortBy(SortByTest, 1, 2, reversenumber)>> |
Line 68: | Line 74: |
Again, prepending 'reverse' to the sort-type changes the order from ascending to descending. | Again, prepending 'reverse' to the sort-type changes the order from ascending to descending. |
Line 71: | Line 78: |
{{{[[SortBy(SortByTest, 1, 3, alpha)]]}}} | {{{<<SortBy(SortByTest, 1, 3, alpha)>>}}} |
Line 73: | Line 80: |
[[SortBy(SortByTest, 1, 3, alpha)]] | <<SortBy(SortByTest, 1, 3, alpha)>> |
Line 75: | Line 82: |
Wiki formatting is ignored, and the sort is stable. The variations of 'word' are simply listed in the same order as they appear in the original table. | Wiki formatting is ignored, and the sort is stable. The variations of 'word' are simply listed in the same order as they appear in the original table. |
Line 78: | Line 86: |
{{{[[SortBy(SortByTest, 1, 3, number)]]}}} | {{{<<SortBy(SortByTest, 1, 3, number)>>}}} |
Line 80: | Line 88: |
[[SortBy(SortByTest, 1, 3, number)]] | <<SortBy(SortByTest, 1, 3, number)>> |
Line 82: | Line 90: |
Now 23 comes before 123, and non-numeric values are sorted in alphabetical order as above. | Now 23 comes before 123, and non-numeric values are sorted in alphabetical order as above. |
Line 85: | Line 94: |
{{{[[SortBy(SortByTest, 1, 1, alpha, 2, number, 3, alpha)]]}}} | {{{<<SortBy(SortByTest, 1, 1, alpha, 2, number, 3, alpha)>>}}} |
Line 87: | Line 96: |
[[SortBy(SortByTest, 1, 1, alpha, 2, number, 3, alpha)]] | <<SortBy(SortByTest, 1, 1, alpha, 2, number, 3, alpha)>> |
Line 89: | Line 98: |
The main sort is on column 1, but within the duplicate 'A's the 2's and 2,000,000 are sorted, and within the 2's the values in column 3 are in case-sensitive alphabetical order. | The main sort is on column 1, but within the duplicate 'A's the 2's and 2,000,000 are sorted, and within the 2's the values in column 3 are in case-sensitive alphabetical order. |
Line 92: | Line 103: |
{{{[[SortBy(SortByTest, 1, 1, nocase, 2, number, 3, nocase)]]}}} | {{{<<SortBy(SortByTest, 1, 1, nocase, 2, number, 3, nocase)>>}}} |
Line 94: | Line 105: |
[[SortBy(SortByTest, 1, 1, nocase, 2, number, 3, nocase)]] | <<SortBy(SortByTest, 1, 1, nocase, 2, number, 3, nocase)>> |
Line 96: | Line 107: |
The main sort is still on column 1, but within the case-insensitive duplicate 'b's the values in column 2 are in numerical order. Also, within the duplicate A-2 rows, column 3 is case-insensitive, so now Wordy follows word. | The main sort is still on column 1, but within the case-insensitive duplicate 'b's the values in column 2 are in numerical order. Also, within the duplicate A-2 rows, column 3 is case-insensitive, so now Wordy follows word. |
Line 99: | Line 112: |
{{{[[SortBy(SortByTest, 0, 1, nocase)]]}}} | {{{<<SortBy(SortByTest, 0, 1, nocase)>>}}} |
Line 101: | Line 114: |
[[SortBy(SortByTest, 0, 1, nocase)]] | <<SortBy(SortByTest, 0, 1, nocase)>> |
Line 106: | Line 119: |
{{{[[SortBy(SortByTest, 3, 1, nocase)]]}}} | {{{<<SortBy(SortByTest, 3, 1, nocase)>>}}} |
Line 108: | Line 121: |
[[SortBy(SortByTest, 3, 1, nocase)]] | <<SortBy(SortByTest, 3, 1, nocase)>> |
Line 113: | Line 126: |
[[SortBy(NonExistentPage, 1, 1, nocase)]] | |
Line 115: | Line 127: |
[[SortBy(SortByTest, 1, 1)]] | <<SortBy(NonExistentPage, 1, 1, nocase)>> |
Line 117: | Line 129: |
[[SortBy(SortByTest, x, 1, alpha)]] | <<SortBy(SortByTest, 1, 1)>> |
Line 119: | Line 131: |
[[SortBy(SortByTest, 1, x, alpha)]] | <<SortBy(SortByTest, x, 1, alpha)>> |
Line 121: | Line 133: |
[[SortBy(SortByTest, -1, 1, alpha)]] | <<SortBy(SortByTest, 1, x, alpha)>> |
Line 123: | Line 135: |
[[SortBy(SortByTest, 10, 1, alpha)]] | <<SortBy(SortByTest, -1, 1, alpha)>> |
Line 125: | Line 137: |
[[SortBy(SortByTest, 1, 0, alpha)]] | <<SortBy(SortByTest, 10, 1, alpha)>> |
Line 127: | Line 139: |
[[SortBy(SortByTest, 1, 10, alpha)]] | <<SortBy(SortByTest, 1, 0, alpha)>> |
Line 129: | Line 141: |
[[SortBy(SortByTest, 1, 1, x)]] | <<SortBy(SortByTest, 1, 10, alpha)>> |
Line 131: | Line 143: |
[[SortBy(SortByTest, 1, 1, alpha, 1)]] | <<SortBy(SortByTest, 1, 1, x)>> <<SortBy(SortByTest, 1, 1, alpha, 1)>> |
Contents
- Original Table
- Column 1 No Sort
- Column 1 Reverse No Sort
- Column 1 Alphabetical
- Column 1 Reverse Alphabetical
- Column 1 Case-Insensitive
- Column 2 Numerical
- Column 2 Alphabetical
- Column 2 Reverse Numerical
- Column 3 Alphabetical
- Column 3 Numerical
- Column 1 Alphabetical, Column 2 Numerical, Column 3 Alphabetical
- Column 1 Case-Insensitive, Column 2 Numerical, Column 3 Case-Insensitive
- Zero Header Rows, Case-Insensitive Sort on Column 1
- Three Header Rows, Case-Insensitive Sort on Column 1
- Invalid Argument Examples
Original Table
First |
Second |
Third |
A |
2,000,000 |
zebra |
C |
1 |
123 |
b |
2 |
word |
d |
30 |
word |
A |
2 |
Wordy |
B |
4.2 |
23 |
A |
2 |
word |
Column 1 No Sort
<<SortBy(SortByTest, 1, 1, nosort)>>
First |
Second |
Third |
A |
2,000,000 |
zebra |
C |
1 |
123 |
b |
2 |
word |
d |
30 |
word |
A |
2 |
Wordy |
B |
4.2 |
23 |
A |
2 |
word |
This simply includes the first table on the source page at this point in the page containing the macro. Rows are in the same order as the original table.
Column 1 Reverse No Sort
<<SortBy(SortByTest, 1, 1, reversenosort)>>
First |
Second |
Third |
A |
2 |
word |
B |
4.2 |
23 |
A |
2 |
Wordy |
d |
30 |
word |
b |
2 |
word |
C |
1 |
123 |
A |
2,000,000 |
zebra |
Similar to the previous example, but now all rows except the one header row are in reverse order.
Column 1 Alphabetical
<<SortBy(SortByTest, 1, 1, alpha)>>
First |
Second |
Third |
A |
2,000,000 |
zebra |
A |
2 |
Wordy |
A |
2 |
word |
B |
4.2 |
23 |
C |
1 |
123 |
b |
2 |
word |
d |
30 |
word |
In alphabetical order all uppercase letters are sorted before lowercase letters.
Column 1 Reverse Alphabetical
<<SortBy(SortByTest, 1, 1, reversealpha)>>
First |
Second |
Third |
d |
30 |
word |
b |
2 |
word |
C |
1 |
123 |
B |
4.2 |
23 |
A |
2,000,000 |
zebra |
A |
2 |
Wordy |
A |
2 |
word |
Prepending 'reverse' to the sort-type changes the order from ascending to descending.
Column 1 Case-Insensitive
<<SortBy(SortByTest, 1, 1, nocase)>>
First |
Second |
Third |
A |
2,000,000 |
zebra |
A |
2 |
Wordy |
A |
2 |
word |
b |
2 |
word |
B |
4.2 |
23 |
C |
1 |
123 |
d |
30 |
word |
Now 'B' and 'b' are considered equal, and are presented in the order they appear in the original table.
Column 2 Numerical
<<SortBy(SortByTest, 1, 2, number)>>
First |
Second |
Third |
C |
1 |
123 |
b |
2 |
word |
A |
2 |
Wordy |
A |
2 |
word |
B |
4.2 |
23 |
d |
30 |
word |
A |
2,000,000 |
zebra |
As you would expect, 30 comes before 2,000,000. Commas are ignored for sorting. Integers and floating point can both be used, and they sort correctly.
Column 2 Alphabetical
<<SortBy(SortByTest, 1, 2, alpha)>>
First |
Second |
Third |
C |
1 |
123 |
b |
2 |
word |
A |
2 |
Wordy |
A |
2 |
word |
A |
2,000,000 |
zebra |
d |
30 |
word |
B |
4.2 |
23 |
In 'alphabetical' order, 2 comes before 3, so 2,000,000 sorts before 30.
Column 2 Reverse Numerical
<<SortBy(SortByTest, 1, 2, reversenumber)>>
First |
Second |
Third |
A |
2,000,000 |
zebra |
d |
30 |
word |
B |
4.2 |
23 |
b |
2 |
word |
A |
2 |
Wordy |
A |
2 |
word |
C |
1 |
123 |
Again, prepending 'reverse' to the sort-type changes the order from ascending to descending.
Column 3 Alphabetical
<<SortBy(SortByTest, 1, 3, alpha)>>
First |
Second |
Third |
C |
1 |
123 |
B |
4.2 |
23 |
A |
2 |
Wordy |
b |
2 |
word |
d |
30 |
word |
A |
2 |
word |
A |
2,000,000 |
zebra |
Wiki formatting is ignored, and the sort is stable. The variations of 'word' are simply listed in the same order as they appear in the original table.
Column 3 Numerical
<<SortBy(SortByTest, 1, 3, number)>>
First |
Second |
Third |
B |
4.2 |
23 |
C |
1 |
123 |
A |
2 |
Wordy |
b |
2 |
word |
d |
30 |
word |
A |
2 |
word |
A |
2,000,000 |
zebra |
Now 23 comes before 123, and non-numeric values are sorted in alphabetical order as above.
Column 1 Alphabetical, Column 2 Numerical, Column 3 Alphabetical
<<SortBy(SortByTest, 1, 1, alpha, 2, number, 3, alpha)>>
First |
Second |
Third |
A |
2 |
Wordy |
A |
2 |
word |
A |
2,000,000 |
zebra |
B |
4.2 |
23 |
C |
1 |
123 |
b |
2 |
word |
d |
30 |
word |
The main sort is on column 1, but within the duplicate 'A's the 2's and 2,000,000 are sorted, and within the 2's the values in column 3 are in case-sensitive alphabetical order.
Column 1 Case-Insensitive, Column 2 Numerical, Column 3 Case-Insensitive
<<SortBy(SortByTest, 1, 1, nocase, 2, number, 3, nocase)>>
First |
Second |
Third |
A |
2 |
word |
A |
2 |
Wordy |
A |
2,000,000 |
zebra |
b |
2 |
word |
B |
4.2 |
23 |
C |
1 |
123 |
d |
30 |
word |
The main sort is still on column 1, but within the case-insensitive duplicate 'b's the values in column 2 are in numerical order. Also, within the duplicate A-2 rows, column 3 is case-insensitive, so now Wordy follows word.
Zero Header Rows, Case-Insensitive Sort on Column 1
<<SortBy(SortByTest, 0, 1, nocase)>>
A |
2,000,000 |
zebra |
A |
2 |
Wordy |
A |
2 |
word |
b |
2 |
word |
B |
4.2 |
23 |
C |
1 |
123 |
d |
30 |
word |
First |
Second |
Third |
The first row is sorted along with all the other rows.
Three Header Rows, Case-Insensitive Sort on Column 1
<<SortBy(SortByTest, 3, 1, nocase)>>
First |
Second |
Third |
A |
2,000,000 |
zebra |
C |
1 |
123 |
A |
2 |
Wordy |
A |
2 |
word |
b |
2 |
word |
B |
4.2 |
23 |
d |
30 |
word |
The first three rows are not sorted along with all the other rows.
Invalid Argument Examples
[[SortBy(NonExistentPage, 1, 1, nocase)]]
SortBy: Unable to open the table page "NonExistentPage"
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 1, 1)]]
SortBy: Not enough arguments (3).
At least 4 are required.
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, x, 1, alpha)]]
SortBy: Number of header rows (x)
must be an integer
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 1, x, alpha)]]
SortBy: Column number (x) must be an integer
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, -1, 1, alpha)]]
SortBy: Number of header rows (-1)
must be a positive integer
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 10, 1, alpha)]]
SortBy: Number of header rows (10) is more than
the table length (8)
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 1, 0, alpha)]]
SortBy: Column number (0) must be 1 or higher.
1 = leftmost column
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 1, 10, alpha)]]
SortBy: Column number (10) is higher than
the length of one or more rows
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 1, 1, x)]]
SortBy: Invalid sort type "x"
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber
[[SortBy(SortByTest, 1, 1, alpha, 1)]]
SortBy: Odd number of arguments (5)
Usage: SortBy(TablePage, <number of header rows>,
<primary sort column number>, <sort type>
[, <secondary sort column>, <sort type>] ... )
Valid sort types are: alpha nocase nosort number reversealpha reversenocase reversenosort reversenumber