Updated September 2019
To insert a column total into the footer (that auto-computes and auto-updates as cell values change), set the footer text to "=SUM." For example:
coldef += "20~10~Qty::=SUM~#E~~
coldef += "30~12~| Weight::| =SUM~#E~~
Comments
The footer must be made visible, by setting XTR.showfooter = 1. See XTR.FOOTERSTYLE for other display attributes of the footer.
Note that the footer in question here is the one built-in to the grid, mirroring the header, not to be confused with the Advanced Coldef Options "Footer=", which defines a page footer for printing, or "TotalLines=", which defines pseudo-footer lines that are actually regular items in the grid.
As illustrated in the second example, the optional header/footer alignment code—"| " for centering—precedes the "=SUM". Typically it isn't necessary to specify an alignment code for the footer though, as the =SUM option will automatically use the same alignment as the column being summed.
The Auto-Sum includes all of the numeric cells in the column.
Beginning with A-Shell 6.5.1666, Auto-Sum can be limited to specific levels in a multi-level tree. As with the regular Auto-Sum feature, it is activated by inserting one of the following tokens into the header, or more typically, the footer part of the header:
=SUM ! standard auto-sum
=SUMLVL(#) ! auto-sum just level #
=SUMLVL(#,#,...#) ! auto-sum the specified levels
The last level in the parenthesized list may have a "+" appended to it, e.g. =SUMLVL(#,#+) indicating all of the levels from the specified one down. So for example, =SUM(0,2+) would include all levels except level 1.
This example includes levels 0, 1 and 2 in the Auto-Sum:
coldef += "20~10~Qty::=SUM(0,1,2)~#E~~
History
2019 September, A-Shell 6.5.1666: Refinement: Add the ability to limit the Auto-Sum feature to specific levels in a multi-level tree.
2018 September, A-Shell 6.5.1647: Refinement: Auto-Sum totals now red if negative.
2018 February, A-Shell 6.5.1631: Auto-Sum capability added.