Desktop User Guides > Professional > Table scripting > Table presentation > Sorting tables > Sorting net elements
 
Sorting net elements
Sample script file: SortedTables.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for more information.
Nets are generally used in multiple response variables to show the number of respondents who chose one or more responses in a group of responses. (A net is different from a subtotal, which simply shows the number of responses that were given.) A typical example of how nets are used is in a multiple response variable based on a question that asks respondents to choose categories from a list that includes positive and negative responses. Two net elements would typically be used to show how many respondents chose one or more positive and negative categories, respectively.
When you sort a table that contains nets, the elements within each net are kept together and sorted separately. To illustrate how it works, we will use the following code to create a table that contains a number of nets:
With TableDoc.Tables
  .AddNew("TableWithNets", _
  "remember{Theoretical 'Theoretically-themed exhibits' net(" + _
  "{Conservation, Ecology, Wildlife_in_danger}), " + _
  "ExtinctLife 'Extinct life forms and evolution' net(" + _
  "{Dinosaurs, Fossils, Evolution, Origin_of_species}), " + _
  "CurrentLife 'Current life forms' net(" + _
  "{Botany, " + _
  "Cold 'Cold-blooded' net(" + _
  "{Fish_and_reptiles, Insects}), " + _
  "Warm 'Warm-blooded' net(" + _
  "{Whales, Birds, Mammals, Human_biology})})}" + _
  " * gender", "Unsorted table with nets")
End With
Here is the unsorted table:
This graphic is described in the surrounding text.
Add the following line to sort the rows of the table on the Base column.
.TableWithNets.SortColumn = "Gender{Base}"
Here is the sorted table:
This graphic is described in the surrounding text.
The elements in each net have been sorted, and that the net groups have been sorted, but that the elements within each net group have been kept together.
You cannot use an element that is inside a net to sort the other axis of the table.
Nets in nested tables
You cannot sort an axis that contains net elements in an outer nest level. Any sorting that would apply to the axis is ignored.
See also
Sorting tables