SP_DOYEAR

DOYEAR()

  Short:
  ------
  DOYEAR() Calculates day of the year from date

  Returns:
  --------
  <nDayOfYear> => day of the year of date

  Syntax:
  -------
  DOYEAR(dTarget)

  Description:
  ------------
  Calculates day of the year from <dTarget>

  Examples:
  ---------
   dDate   := ctod("10/15/90")
   nDoYear := DOYEAR(dDate)   //(returns 288)

  Source:
  -------
  S_DOYEAR.PRG

 

SP_DELREC

DELREC()

  Short:
  ------
  DELREC() Dialog box to delete/undelete current record

  Returns:
  --------
  <nStatus> => If deleted 1, if undeleted-1, if no
  action 0

  Syntax:
  -------
  DELREC()

  Description:
  ------------
  Asks for delete/undelete record with menu prompt and
  then deletes/undeletes or not If current record is not deleted,
  prompt will be

       DELETE  NOACTION

  If current record is deleted, prompt will be

       UNDELETE  NOACTION

  Examples:
  ---------
   IF nChoice = 6
       nDelstat := DELREC()
   ENDIF

  Source:
  -------
  S_DELET.PRG

 

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_DBSTATS

DBSTATS()

  Short:
  ------
  DBSTATS() Statistical report on dbf, including
  sum/avg/min/max/std/var/count

  Returns:
  --------
  Nothing

  Syntax:
  -------
  DBSTATS()

  Description:
  ------------
  This is a point & shoot metafunction which allows the
  user to get statistical data on a dbf, particularly with
  numeric fields.

  Statistics available are: count, sum, average,
  minimum, maximum, variance and standard deviation. the analysis
  may also be based on a conditional criteria.

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

   DBSTATS()    // its a menu driven metafunction

  Source:
  -------
  S_DBSTAT.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_DAYSIN

DAYSIN()

  Short:
  ------
  DAYSIN() Calculates number of days in a month

  Returns:
  --------
  <nDays> => days in month of target date

  Syntax:
  -------
  DAYSIN(dTarget)

  Description:
  ------------
  Returns # of days in month in which <dTarget> falls

  Examples:
  ---------
   dDate    := ctod("10/15/89")

   nDimonth := DAYSIN(dDate)  // (returns 31)

  Source:
  -------
  S_DAYSIN.PRG

 

SP_DATECALC

DATECALC()

  Short:
  ------
  DATECALC() Adds/subtracts days,weeks,months,years to a date

  Returns:
  --------
  <dNew> => new date

  Syntax:
  -------
  DATECALC(dStart,nUnits,nUnitType)

  Description:
  ------------
  <nUnits> is the number of units to add or subtract.
  If negative, subtraction takes place.

  <nUnitType> is the type of unit, where 1=days ,2=wks,
  3=mnths, 4=yrs

  <dStart> is the source date, to which units are added
  or subtracted.

  Examples:
  ---------
   dDate          := ctod("10/15/89")

   dLess5days    := DATECALC(dDate,-5,1)  // subtract 5 days
   dLess5weeks   := DATECALC(dDate,-5,2)  // subtract 5 weeks
   dAdd5months   := DATECALC(dDate,5,3) // add 5 months
   dAdd5years    := DATECALC(dDate,5,4)  // add 5 years

  Notes:
  -------
  Month adding/subtracting where the day of current
  month is greater than the # of days in the target month is done
  by using the # of days in the target month. i.e. 01/31/90 + 1
  month = 02/28/90

  If the input date is Feb 29th of a leap year, it is
  adjusted to Feb 28th before month or year calculations.

  Source:
  -------
  S_DATCAL.PRG

 

SP_CURD

CURD()

  Short:
  ------
  CURD() Return current drive letter

  Returns:
  --------
  <cDrive> => drive letter

  Syntax:
  -------
  CURD()

  Description:
  ------------
  Returns the current drive letter, less colon (:).

  Examples:
  ---------
   ?"Current drive is ",CURD(),":"

  Source:
  -------
  CURD.PRG

 

SP_CTRLW

CTRLW()

  Short:
  ------
  CTRLW() Sends chr(23) (Control-W) to the keyboard

  Returns:
  --------
  Nothing

  Syntax:
  -------
  SET KEY XXX to CTRLW

  Description:
  ------------
  Allows remapping a key to Ctrl-W - a common Clipper
  EXIT key. CTRL-W is not a really intuitive key, but is often
  required by Clipper. I'll often set F10 to act as Ctrl-W.

  Examples:
  ---------
   EXTERNAL CTRLW

   SET KEY 27 to CTRLW  // remaps ESCAPE to CTRL-W
   also
   SETKEY(K_F10,{||ctrlw()})

  Notes:
  -------
  Declare as EXTERNAL i.e. EXTERNAL CTRLW

  Source:
  -------
  S_CTRLW.PRG

 

SP_CRUNCH

CRUNCH()

  Short:
  ------
  CRUNCH() Moves spaces in a string to end of string

  Returns:
  --------
  <cCrunched> string with spaces moved to end

  Syntax:
  -------
  CRUNCH(cOriginal,nAllor1)

  Description:
  ------------
  Moves spaces to end of string <cOriginal>. If
  <nAllor1> = 1, moves all but single spaces to right end of the
  string. If <nAllor1> = 0 moves all spaces to the right end.

  Examples:
  ---------

  cString := "SUPER    Library version 2.50"

  cString := CRUNCH(cString,1) // "SUPER Library version 2.50  "

  cString := CRUNCH(cString,0) // "SUPERLibraryversion2.50     "

  Notes:
  -------
  Handy for names (i.e. FIRST and LAST)

  Source:
  -------
  S_CRUNCH.PRG