SP_ASUM

ASUM()

  Short:
  ------
  ASUM() Determines the sum of an array with condition

  Returns:
  --------
  <nArraySum> => Array sum

  Syntax:
  -------
  ASUM(aTarget,[bCondition])

  Description:
  ------------
  <aTarget> is the target array. Normally an array of
  numeric values. [bCondition] is an optional codeblock used to
  select a subset of the array. This could be used to filter out
  0's or non-numeric elements.

  The block must accept an array element as a
  parameter, and return true or false <expL> to determine if this
  element is part of the desired subset.

  Examples:
  ---------
   v := ASUM(aSales)
   v := ASUM(aSales,{|e|valtype(e)=="N".and.e<>0})

  Source:
  -------
  S_ASTATS.PRG

 

One response to “SP_ASUM

  1. Pingback: SP Array Functions | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.