Sorting Tables

You can sort a table by selecting an option from the Table ribbon at the top of the interface or from table context menus. Tables can be sorted using a simple or more advanced method.

  • Simple Sort You can sort rows in ascending or descending order, numerically and alphabetically (numbers are first, then letters).
  • Advanced Sort You can sort tables using advanced options, choosing which columns to sort first. In addition, you can sort tables in this manner immediately, at compile time, or both.

How to Sort Tables—Simple

  1. Open the document or topic.
  2. Do one of the following:
    • If you want to sort all rows in the table, place your cursor inside the table. The rows will be reordered based on the column where your cursor is placed.

    • If you want to sort only certain rows in the table, select those rows so that they are highlighted. The rows will be reordered based on the content of the first column in your selection.

  3. Do one of the following, depending on the part of the user interface you are using:

    • Ribbon Select Table > Ascending > Ascending or Table > Ascending > Descending.
    • Right-Click Do one of the following:
      • Right-click inside the table and from the context menu, select Sort Rows > Ascending or Sort Rows > Descending.
      • Right-click one of the appropriate tag bars to the left of the table, depending on the rows you want to sort (e.g., table, thead, tfoot), and from the context menu, select Sort Rows > Ascending or Sort Rows > Descending.
  4. Click Save the active file. to save your work.

How to Sort Tables—Advanced

  1. Open the document or topic.
  2. Place your cursor inside the table.
  3. Do one of the following, depending on the part of the user interface you are using:

    • Ribbon Select Table > Ascending > Advanced Sorting Options.
    • Right-Click Do one of the following:
      • Right-click inside the table and from the context menu, select Sort Rows > Advanced Sorting Options.

        OR

      • Right-click one of the appropriate tag bars to the left of the table, depending on the rows you want to sort (e.g., table, thead, tfoot), and from the context menu, select Sort Rows > Advanced Sorting Options.

    The Advanced Sorting Options dialog opens.

  4. Click . A row is added to the grid on the right.
  5. In the Column cell, click the down arrow and choose the column to sort by. Then in the Direction cell choose ascending or descending.
  6. (Optional) If you want to add another row, telling Contributor which column to sort by next, click again. In the Column cell, click the down arrow and choose the column to sort by next. Then in the Direction cell choose ascending or descending. Repeat this for each additional row you want to add to the grid.
  7. (Optional) Use the buttons on the right side of the dialog if you want to remove or rearrange the order of any of the rows in the grid.
  8. (Optional) If you want Contributor to automatically update the table sorting when you generate output, select Apply at compile time. This can be useful in case you make changes to the table in the XML Editor and want Contributor to automatically make the changes so you don't have to.
  9. (Optional) If you want Contributor to apply the sorting rules to the table right away in the XML Editor, click Apply now.
  10. Click OK.
  11. Click Save the active file. to save your work.

Example You have a table listing winners of the New York Marathon for a 10-year period, like this:

Suppose you want to re-organize the information in this table. Maybe you want to sort first of all by the country of each runner (the third column) in ascending order.

With the third column organized, you then want the rows to be organized once more according to the best times (the fourth column) in ascending order.

So you right-click the table structure bar and choose Sort Rows, then Advanced Sorting Options.

In the Advanced Sorting Options dialog, your settings would look like this:

As a result, the table would be reorganized to look like this:

What’s Noteworthy?

Note This feature is not supported for MadCap Lingo review package (LIREV) files.