Advanced tables and statistics > Row and table manipulation > Manipulation on N-statements
 
Manipulation on N-statements
Quick reference
To manipulate the figures in an existing element, include the option:
ex=manip_expression
as part of that element’s definition.
More information
ex= can be used on n statements to manipulate the figures in that row prior to printing. For example, the row showing the number of loaves bought per person in the table above could be specified as:
n01Loaves Bought Per Person;inc=c(250,251);ex=/@1
In most cases you will see no difference in a table between a row created with m and the same row created using n01;ex=. The difference is an invisible one to do with the efficiency of your code.
An m statement performs whatever calculation is specified with its ex=. When Quantum reads an n01 with an ex=, it ignores the ex= at first and calculates cell counts based on the data and any inc= specifications. Once these calculations are finished and the basic cell counts are available, Quantum applies the ex= specification.
So, which method should you use?
If the values that are used to create the m row need to appear in the table as rows in their own right, as in the example on the previous page, then an m is more efficient.
If an ex= expression on an n01 uses values that need to be calculated by that statement, and those values do not need to appear in the table, then using n01;ex= is more efficient. In the example, using this approach would only have been better if you had not wanted to see the row showing the number of loaves bought.
See also
Row and table manipulation