SP_DELARRAY

DELARRAY()

  Short:
  ------
  DELARRAY() Deletes all elements of an array

  Returns:
  --------
  Nothing

  Syntax:
  -------
  DELARRAY(aTarget)

  Description:
  ------------
  Deletes all elements of an array <aTarget>. Basically
  un-initializes the array.

  Examples:
  ---------
     // Same as

   afill(aTarget,nil)

   (In 5.01 you can do afill(aTarget,NIL) instead, but
  this is here for compatibility.)

  Source:
  -------
  S_DELAR.PRG

 

SP_DBF2ARRAY

DBF2ARRAY()

  Short:
  ------
  DBF2ARRAY() Returns an array of values for the current record

  Returns:
  --------
  <aValues> => an array of values in the current record

  Syntax:
  -------
  DBF2ARRAY()

  Description:
  ------------
  Returns an array of values for the current record,
  with the order of the array the same as the ordinal field
  order.

  Examples:
  ---------
   use customer

   a := DBF2ARRAY()            // store values
   for i = 1 to len(a)
     @0+i,0 get a[i]
   next

   read                        // edit them
   if AUPDATED(a)              // if they were updated from  the DBF values
     ARRAY2DBF(a)              // save them
   endif

  Source:
  -------
  S_DBARR.PRG

 

SP_COPYFIELDS

COPYFIELDS()

  Short:
  ------
  COPYFIELDS() Copies selected fields of selected records to new dbf

  Returns:
  --------
  None

  Syntax:
  -------
  COPYFIELDS([aFields,[aDescript]])

  Description:
  ------------
  This metafunction allows selection of fields, and
  selection of record criteria (filter) to be copied to a new DBF.

  [aFields]  is an array of valid field names. Default
  is all fields. Fields not of the current area are not allowed.

  [aDescript] is an array of field descriptions, which
  can only be passed if [aFields]  is passed, and which must
  reflect the fields in [aFields]

  Examples:
  ---------
   use (cDbfName)

   COPYFIELDS()  // its a metafunction...

  Source:
  -------
  S_COPYF.PRG

 

SP_CLABEL

CLABEL()

  Short:
  ------
  CLABEL() Menu driven module for label management

  Returns:
  --------
  Nothing

  Syntax:
  -------
  CLABEL([aInFieldNames,aInFieldDesc,aInFieldTypes],[lUseBuildex],[lRelease])

  Description:
  ------------
  This function requires no parameters and is entirely
  menu driven. Clipper compatible LBL files can be imported from.
  Definitions are stored in a DBF format. Labels may be printed by
  Query matches, by Tagging, or all records.

  Three arrays may be passed - <aInFieldNames> is an
  array of allowable field names. <aInFieldDesc>  is an array of
  field descriptions. <aInFieldTypes> is an array of field types.
  All three must be passed, or none. All fields are used as
  default, with field names being the default field descriptions.

  [lUseBuildex] if True, allows calling BUILDEX() to
  build complex expressions.

  [lRelease] if this is TRUE, CLABEL() will release the printer every
  50 labels. If on a network, this will allow the queue to empty out.
  If you are printing a bunch of labels, this can be important. Default
  is False.

  Examples:
  ---------
   use CUSTOMER

   CLABEL()

       or

   USE CUSTOMER
   aFlds := {"FNAME","LNAME","MI"}
   aFdes := {"First","Last","Middle"}
   aType := {"C","C","C"}
   CLABEL(aFlds,aFdes,aType,.t.)

  Notes:
  -------
  Requires datafile to be open.

  Reads Clipper compatible LBL files. Writes to a DBF.
  Does not call LABEL FORM. instead, uses its own label printing
  routine. Label printing routine optionally compresses blank
  lines (i.e. a 2nd address), as well as removing all but single
  space in a line (i.e. FIRSTNAME+ LASTNAME) See SLSF_LABEL() for
  notes on the storage DBF.

  Source:
  -------
  S_CLAB.PRG

 

SP_BROWSE2D

BROWSE2D()

  Short:
  ------
  BROWSE2D() Popup  tbrowse of 2 dimension array (array of arrays)

  Returns:
  --------
  <nSelection> => selected item, 0 if none

  Syntax:
  -------
  BROWSE2D(nTop,nLeft,nBottom,nRight,aArr,[aHead],[cColor],;
        [cTitle],[bExcept])

  Description:
  ------------
  Pops up a box at <nTop,nLeft,nBottom,nRight> and
  tbrowses array contained in <aArr>.

  <aArr> must be a 2 dimensioned array, like the ones
  returned from DIRECTORY() or DBSTRUCT().

  i.e. { array(n),array(n),array(n) } where <n> is the
  same length for each subarray.

  [aHead] an array of column headers matching the
  number of elements in a single subarray of <aArr>. Default is
  none.

  [cColor] popup box color. Default is sls_popcol()

  [cTitle] title string for the box. Default is none.

  [bExcept] is a codeblock that will be evaluated for
  any exception keys - any keys other than up/ down/ right/ left/
  pgup/ pgdn/ home/ end/ enter/ esc. [bExcept] will be passed the
  parameters: key value, tbrowse object, element

  Examples:
  ---------

   proc test

   local a := directory()
   browse2d(5,5,20,40,a, ;
           {"File","Size","Date","Time","Attribute"},,"Choose a File")

   use customer
   a := dbstruct()
   browse2d(5,5,20,40,a,nil,nil,nil,;
    {|k|msg(str(k)+" is not a valid key")})
   // note the exception block

  Source:
  -------
  S_2DBRZ.PRG

 

SP_BLDDBF

BLDDBF()

  Short:
  ------
  BLDDBF() Create a DBF from a delimited string or an array

  Returns:
  --------
  <lSuccess> => Success or failure

  Syntax:
  -------
  BLDDBF(cDbfName,acDefinition)

  Description:
  ------------
  Creates DBF file named <cDbfName> from delimited
  strings in <acDefinition>.

  <acDefinition>  is either:

  1.  a Delimited string in the form
      "name,type,[size],[decimals]:name,type..."
      Fields delimited by colon, field elements delimited by commas

  2.  an array of delimited strings in
      the form "name,type,[size],[decimals]". One field
      per array element, field elements delimited by
      commas.

  Examples:
  ---------
   1. Passing long delimited string

       BLDDBF('CUSTOMER','LNAME,C,15:FNAME,;
         C,10:AGE,N,2:PROSPECT,L:')

   2. Passing array of short delimited strings

       aNewdbf       := array(4)
       aNewdbf[1]    :="LNAME,C,15"
       aNwdbf[2]     :="FNAME,C,10"
       aNewdbf[3]    :="AGE,N,2"
       aNewdbf[4]    :="PROSPECT,L"
       lSuccess      := BLDDBF('CUSTOMER',aNewdbf)

  Notes:
  -------
  BLDDBF() expects an unused area to work in, and will
  return .f. if it detects a DBF open in the current area. An
  overwrite will not be allowed. BLDDBF() uses Clipper's low level
  file functions to create the DBF file. You could also (and
  should) use Clipper 5.01's DBCREATE() function. This function is
  here mainly for compatibility with previous SuperLibs.

  Source:
  -------
  S_BLDBF.PRG

SP_BIGELEM

BIGELEM()

  Short:
  ------
  BIGELEM() Returns length of longest string in an array

  Returns:
  --------
  <nLength> => Length of longest string in an array

  Syntax:
  -------
  BIGELEM(aTarget)

  Description:
  ------------
  Determines the length of the longest string element
  in <aTarget> Array may have mixed types

  Examples:
  ---------
   ?BIGELEM(  {"1","22","333"}  )  => returns 3

  Notes:
  -------
  This was a C function in previous SuperLibs

  Source:
  -------
  S_BIGEL.PRG

 

SP_AVARIANCE

AVARIANCE()

  Short:
  ------
  AVARIANCE() Determines the variance of an array with condition

  Returns:
  --------
  <nVariance> => Array variance

  Syntax:
  -------
  AVARIANCE(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 := AVARIANCE(aSales)
   v := AVARIANCE(aSales,{|e|valtype(e)=="N".and.e<>0})

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

 

SP_AUPDATED

AUPDATED()

  Short:
  ------
  AUPDATED() Determines if array contains updated values for record

  Returns:
  --------
  <lUpdated> => Are the values in the array updated

  Syntax:
  -------
  AUPDATED(aCheck)

  Description:
  ------------
  Compares the values in an array (usually created with
  a call to DBF2ARRAY() )  <aCheck> with the current values in the
  current record. The order of the array is presumed to match the
  order of the fields, and to be of length fcount(). If the values
  in the array are updated (changed), True is returned.

  Examples:
  ---------
   use customer
   a := DBF2ARRAY()            // store values
   for i = 1 to len(a)
     @0+i,0 get a[i]
   next
   read                               // edit them
   if AUPDATED(a)              // if they were updated from  the DBF values
     ARRAY2DBF(a)              // save them
   endif

  Source:
  -------
  S_DBARR.PRG

 

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