[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----+####################################################################
#+-| SUM |-----------------------------------------------------+##############
#| +-----+ The SUM command totals <Exp-list> for each record |##############
#| within [Scope] for the current or selected database |##############
#| then assigns the result to <Var-list> |##############
#+-------------------------------------------------------------+##############
##############################################################################
##############################################################################
#+--| Syntax |---------------------------------------------+##################
#| [!<Alias>] SUM [Scope] <Exp-list> TO <Var-list> |##################
#+---------------------------------------------------------+##################
##############################################################################
##############################################################################
#####+---| Description |-----------------------------------------------+######
#####| SUM adds the value of all expressions in <Exp-list> for all |######
#####| records in an alias and assigns the result to the corresponding |######
#####| variable in <Var-list>. Variables defined in <Var-list> must be |######
#####| type DBL and may not be field variables. |######
#####| --------------------------------------------------------------- |######
#####| The default scope of the SUM command is ALL. |######
#####+-----------------------------------------------------------------+######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Calculate the total cost of a product if |#########
#########| * a discount is included |#########
#########| |#########
#########| !totals SUM REST totals->cost * discount TO t_cost |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * SUM several expressions at one time. |#########
#########| |#########
#########| !t SUM e->f1, e->f2, e->f3 TO s1,s2,s3 |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Calculate the dollar amount in inventory. |#########
#########| |#########
#########| !inv SUM prod->invcost TO product_cost |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
AVERAGE
COUNT
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson