MOL (Marek Olszewski)

Contributed samples by MOL (Marek Olszewski)

Backup-Restore

Billing System ( definable buttons )

Calculator

Copy To Clipboard

Deactivate menu

Debug Message

Download from www

EAN13 BarCode Generator

Filter in Browse

HMG with MS SQL server

Incremental Search in BROWSE 

Menu like ACHOICE

Moldruk (Print like DOS )

Set Status Bar Item

Send mails via SMTP

Using ProgressBar as a graph

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_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_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

 

SP_AMSUM

AMSUM()

  Short:
  ------
  AMSUM() Sum on a given element of multi-dim array

  Returns:
  --------
  <nSum> => sum of array element

  Syntax:
  -------
  AMSUM(aMult,nElem,[bCondition])

  Description:
  ------------
  Returns sum of array <aMult> element <nElem>.

  [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 a subarray as a
  parameter, and return  true or false <expL> to determine if this
  element is part of the desired subset. Please note that the
  codeblock accepts the whole subarray, not  just subarray element
  <nElem>

  Examples:
  ---------

   ?"Total file size here is "
   ??AMSUM(DIRECTORY(),2)

   ?"Total .EXE file size here is "
   ??AMSUM(DIRECTORY(),2,{|e|".EXE"$e[1]}  )

   use customer
   ?"Total field size "
   ??AMSUM(DBSTRUCT(),3)

   use customer
   ?"Total CHARACTER field size "
   ??AMSUM(DBSTRUCT(),3,{|e|e[2]=="C"} )

  Notes:
  -------
  Coded by Matthew Maier.

  Presumes all sub-arrays are of equal length

  Source:
  -------
  S_AMSTAT.PRG

 

SP_AMSTDDEV

AMSTDDEV()

  Short:
  ------
  AMSTDDEV() Standard Deviation on a given element of
  multi-dim array

  Returns:
  --------
  <nVariance> => average of array element

  Syntax:
  -------
  AMSTDDEV(aMult,nElem,[bCondition])

  Description:
  ------------
  Returns Standard Deviation of array <aMult> element
  <nElem>.  [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 a subarray as a parameter, and
  return true or false <expL> to determine if this element is
  part of the desired subset. Please note that the codeblock
  accepts the whole subarray, not  just subarray element <nElem>

  Examples:
  ---------
   ?"Total file size here is "
   ??AMSUM(DIRECTORY(),2)

   ?"Total .EXE file size here is "
   ??AMSUM(DIRECTORY(),2,{|e|".EXE"$e[1]}  )

   ?"Standard Deviation:"
   ??AMSTDDEV(DIRECTORY(),2,{|e|".EXE"$e[1]}  )

  Notes:
  -------
  Coded by Matthew Maier.

  Presumes all sub-arrays are of equal length

  Source:
  -------
  S_AMSTAT.PRG

 

SP_AMAVERAGE

AMAVERAGE()

  Short:
  ------
  AMAVERAGE() Average on a given element of multi-dim array

  Returns:
  --------
  <nAverage> => average of array element

  Syntax:
  -------
  AMAVERAGE(aMult,nElem,[bCondition])

  Description:
  ------------
  Returns average of array <aMult> element <nElem>.

  [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 a subarray as a
  parameter, and return  true or false <expL> to determine if this
  element is part of the desired  subset.

  Please not that the codeblock accepts the whole
  subarray, not  just subarray element <nElem>

  Examples:
  ---------

   ?"Average file size here is "
   ??amaverage(DIRECTORY(),2)

   ?"Average .EXE file size here is "
   ??amaverage(DIRECTORY(),2,{|e|".EXE"$e[1]}  )

   use customer
   ?"Average field size "
   ??amaverage(DBSTRUCT(),3)

  Notes:
  -------
  Presumes all sub-arrays are of equal length

  Coded by Matthew Maier.

  Source:
  -------
  S_AMSTAT.PRG