FT_SAVEARR

 FT_SAVEARR()
 Save Clipper array to a disc file.

 Syntax

      FT_SAVEARR( <aArray>, <cFileName>, <nErrorCode> ) -> lRet

 Arguments

     <aArray> is any Clipper array except those containing
     compiled code blocks.

     <cFileName> is a DOS file name.

     <nErrorCode> will return any DOS file error.

     All arguments are required.

 Returns

     .F. if there was a DOS file error or the array contained
     code blocks, otherwise returns .T.

 Description

     FT_SAVEARR() saves any Clipper array, except those
     containing compiled code blocks, to a disc file.  The
     array can be restored from the disc file using
     FT_RESTARR().

     [10/1/92 Librarian note:

     This function does not appear to work with multi-dimensional
     arrays.  If you'd care to modify it to support this feature,
     please do and send it to Glenn Scott 71620,1521.]

 Examples

    aArray := { {'Invoice 1',CTOD('04/15/91'),1234.32,.T.},;
                {'Invoice 2',DATE(),234.98,.F.},;
                {'Invoice 3',DATE() + 1,0,.T.}  }
    nErrorCode := 0
    FT_SAVEARR(aArray,'INVOICE.DAT',@nErrorCode)
    IF nErrorCode = 0
      aSave := FT_RESTARR('INVOICE.DAT',@nErrorCode)
      IF nErrorCode # 0
         ? 'Error restoring array'
      ENDIF
    ELSE
      ? 'Error writing array'
    ENDIF

 Source: SAVEARR.PRG

 Author: David Barrett

See Also: FT_RESTARR()


			

FT_RESTARR

FT_RESTARR()
 Restore a Clipper array from a disc file

 Syntax

      FT_RESTARR( <cFileName>, <nErrorCode> ) -> aArray

 Arguments

     <cFileName> is a DOS file name.

     <nErrorCode> will return any DOS file error.

     All arguments are required.

 Returns

     Return an array variable.

 Description

     FT_RESTARR() restores an array which was saved to
     a disc file using FT_SAVEARR().

     [10/1/92 Librarian note:

     This function does not appear to work with multi-dimensional
     arrays.  If you'd care to modify it to support this feature,
     please do and send it to Glenn Scott 71620,1521.]

 Examples

    aArray := { {'Invoice 1',CTOD('04/15/91'),1234.32,.T.},;
                {'Invoice 2',DATE(),234.98,.F.},;
                {'Invoice 3',DATE() + 1,0,.T.}  }
    nErrorCode := 0
    FT_SAVEARR(aArray,'INVOICE.DAT',@nErrorCode)
    IF nErrorCode = 0
      aSave := FT_RESTARR('INVOICE.DAT',@nErrorCode)
      IF nErrorCode # 0
         ? 'Error restoring array'
      ENDIF
    ELSE
      ? 'Error writing array'
    ENDIF

 Source: SAVEARR.PRG

 Author: David Barrett

See Also: FT_SAVEARR()


FT_ASUM

FT_ASUM()
 Sum the elements of an array

 Syntax

      FT_ASUM( <aArray> [, <nStartIndex> [, <nEndIndex> ] ] ) -> nSum

 Arguments

     <aArray> is the array containing the elements to be summed.

     <nStartIndex> is the first array item to include,
     defaults to first element.

     <nEndIndex> is the last array element to include,
     defaults to all elements.

 Returns

     The sum of the elements of the array or the lengths of the elements.

 Description

     This function is to sum the elements of a numeric array or to sum the
     lengths of a character array.

 Examples

     FT_ASUM(aSubTotals)               // Sum the Entire Array

     FT_ASUM(aSubTotals, 5)            // Sum from the 5th Element On

     FT_ASUM(aSubTotals, , 10)         // Sum the 1st 10 Elements

     FT_ASUM(aSubTotals, 5, 10)        // Sum Elements 5-10

 Source: ASUM.PRG

 Author: David Husnian


 

FT_AREDIT

FT_AREDIT()
 2 dimensional array editing function using TBrowse

 Syntax

      FT_AREDIT( <nTop>, <nLeft>, <nBottom>, <nRight>, <Array Name>, ;
         <nElem>, <aHeadings>, <aBlocks> [, <bGetFunc> ] ) -> xElement

 Arguments

     <nTop>, <nLeft>, <nBottom>, <nRight> are coordinates for TBrowse

     <Array Name> is name of 2 dimensional to array edit

     <nElem>      is pointer for element in array

     <aHeadings>  is array of column headings

     <aBlocks>    is array of blocks describing each array element

     [ <bGetFunc> ] is get editing function for handling individual elements

 Returns

     Value of element positioned on when exit FT_AREDIT()
     The type of this value depends on what is displayed.

 Description

     This function allows you to position yourself in an array,
     add and delete rows with the <F7> and <F8> keys,
     and pass a UDF with information to edit the individual gets.

 Examples

      FT_AREDIT(3, 5, 18, 75, ar, @nElem, aHeadings, aBlocks)

      This example will allow you to browse a 2 dimensional array
      But you can't edit it since there is no GetBlock UDF
      It allows the user to hit ENTER to select an element or ESC to
      return 0

      * This second example shows how to edit a 2 dimensional array
      * as might be done to edit an invoice

            LOCAL i, ar[3, 26], aBlocks[3], aHeadings[3]
            LOCAL nElem := 1, bGetFunc

      * Set up two dimensional array "ar"

            FOR i = 1 TO 26
               ar[1, i] := i          //  1  ->  26  Numeric
               ar[2, i] := CHR(i+64)  // "A" -> "Z"  Character
               ar[3, i] := CHR(91-i)  // "Z" -> "A"  Character
             NEXT i

      * SET UP aHeadings Array for column headings

            aHeadings  := { "Numbers", "Letters", "Reverse" }

      * Need to set up individual array blocks for each TBrowse column

        aBlocks[1] := {|| STR(ar[1, nElem], 2) } // prevent default 10 spaces
        aBlocks[2] := {|| ar[2, nElem] }
        aBlocks[3] := {|| ar[3, nElem] }

      * set up TestGet() as the passed Get Function so FT_ArEdit knows how
      * to edit the individual gets.

        bGetFunc   := { | b, ar, nDim, nElem | TestGet(b, ar, nDim, nElem) }
        SetColor( "N/W, W/N, , , W/N" )
        CLEAR SCREEN
        FT_AREDIT(3, 5, 18, 75, ar, @nElem, aHeadings, aBlocks, bGetFunc)

 Source: AREDIT.PRG

 Author: James J. Orlowski, M.D.

 

FT_ANOMATCHES

FT_ANOMATCHES()
 Find the number of array elements meeting a condition

 Syntax

      FT_ANOMATCHES( <aArray>, <bCompareBlock> ;
                     [, <nStartIndex> [, <nEndIndex> ] ] ) -> nNoOfMatches

 Arguments

     <aArray> is the array to be searched

     <bCompareBlock> is a code block containing the expression for
     the array elements to be tested with.  Each element is passed
     as a parameter to the block.  If the block returns .T., the
     number of matches will be incremented by one.

     <nStartIndex> is the first array item to include in the search,
     defaults to first element.

     <nEndIndex> is the last array element to include in the search,
     defaults to all elements.

 Returns

     The number of elements that cause the code block to return .T.

 Description

     This function returns the number of array elements that, when passed
     to the supplied code block, cause that code block to return a .T. value.

 Examples

     // Search the Entire Array
     FT_ANOMATCHES(aTries, { | x | x <= 100 } )

     // Search from the 5th Element On
     FT_ANOMATCHES(aCodes, { | x | UPPER(x) == cCurrentCode }, 5)

     // Search the 1st 10 Elements
     FT_ANOMATCHES(aDates, { | x | IS_BETWEEN(DATE()-7,x,DATE() + 7) }, 10)

     // Search Elements 5-10
     FT_ANOMATCHES(aNames, { | x | x <= cLastGoodName }, 5, 10)

 Source: ANOMATCH.PRG

 Author: David Husnian

FT_AMEDIAN

 FT_AMEDIAN()
 Find middle value in array, or average of two middle values

 Syntax

      FT_AMEDIAN( <aArray> [, <nStart> [, <nEnd> ] ] )
                 -> nMedian

 Arguments

     <aArray> is the array containing the elements to be averaged.

     <nStart> is the first array element to include,
     defaults to first element.

     <nEnd> is the last array element to include,
     defaults to last element.

 Returns

     The median average of the array elements

 Description

     This function sorts the elements of a numeric array and
     then returns the value in the middle element of the sorted
     array.  If there is no exact middle value, then it returns
     the average of the two middle values.  Half of the elements
     are > median and half are < median.  A median average may
     more reflect a more useful average when there are extreme
     values in the set.

 Examples

     FT_AMEDIAN( aArray )      // Return Median for entire array

     FT_AMEDIAN( aArray, 2)    // Return Median for elements from 2 to end

     FT_AMEDIAN( aArray, ,9)   // Return Median for 1st 9 elements

     FT_AMEDIAN( aArray,8,40 ) // Return Median for elements 8 to 40

 Source: AMEDIAN.PRG

 Author: Ralph Oliver,  TRANSCOM SYSTEMS

 

FT_AEMINLEN

FT_AEMINLEN()
 Find shortest element within an array

 Syntax

      FT_AEMINLEN( <aArray> [, <nDimension> [, <nStart> [, <nCount> ] ] ] )
                 -> nMinlen

 Arguments

     <aArray> is the array containing the elements to be measured.

     <nDimension> is the array dimension to be measured,
                defaults to first dimension.

     <nStart> is the starting array element to include,
                defaults to first array element.

     <nCount> is the number of array elements to process from
                from <nStart>, defaults to remaining elements
                in array.

 Returns

     The length of the shortest size element of an array.

 Description

     This function will measure each element of an array
     dimension and return the shortest element.

 Examples

     FT_AEMINLEN(aArray)       // Measure the 1st dimension of an Array

     FT_AEMINLEN(aArray,2)     // Measure the 2nd dimension of an Array

     FT_AEMINLEN(aArray,2,,9)  // Measure Elements 1-9 of 2nd dimension

     FT_AEMINLEN(aArray,3,5,9) // Measure Elements 5-9 of 3rd dimension

     FT_AEMINLEN(aArray,3,5)   // Measure Elements 5 to end of 3rd dimension

 Source: AEMINLEN.PRG

 Author: Ralph Oliver,  TRANSCOM SYSTEMS

See Also: FT_AEMAXLEN()


			

FT_AEMAXLEN

 FT_AEMAXLEN()
 Find longest element within an array

 Syntax

      FT_AEMAXLEN( <aArray> [, <nDimension> [, <nStart> [, <nCount> ] ] ] ) ;
                 -> nMaxlen

 Arguments

     <aArray> is the array containing the elements to be measured.

     <nDimension> is the array dimension to be measured,
                defaults to first dimension.

     <nStart> is the starting array element to include,
                defaults to first array element.

     <nCount> is the number of array elements to process from
                from <nStart>, defaults to remaining elements
                in array.

 Returns

     The length of the longest size element of an array.

 Description

     This function will measure each element of an array
     dimension and return the longest element.

 Examples

     FT_AEMAXLEN(aArray)       // Measure the 1st dimension of an Array

     FT_AEMAXLEN(aArray,2)     // Measure the 2nd dimension of an Array

     FT_AEMAXLEN(aArray,2,,9)  // Measure Elements 1-9 of the
                                     2nd dimension or subarray

     FT_AEMAXLEN(aArray,3,5,9) // Measure Elements 5-9 of the
                                     3rd dimension or subarray

     FT_AEMAXLEN(aArray,3,5)   // Measure Elements 5 to last in the
                                     3rd dimension or subarray

 Source: AEMAXLEN.PRG

 Author: Ralph Oliver,  TRANSCOM SYSTEMS

See Also: FT_AEMINLEN()


			

FT_ADESSORT

FT_ADESSORT()
 Sort an array in descending order
------------------------------------------------------------------------------

 Syntax

      FT_ADESSORT( <aArray> [, <nStartIndex> [, <nEndIndex> ] ] ) -> aSorted

 Arguments

     <aArray> is the array to be sorted

     <nStartIndex> is the first array item to include in the sort,
     defaults to first element

     <nEndIndex> is the last array element to include in the sort,
     defaults to all elements

 Returns

     The array, sorted in descending order.

 Description

     This function is used to sort an array in descending order, i.e., Z-A

 Examples

     FT_ADESSORT(aNames)               // Sort the Entire Array

     FT_ADESSORT(aNames, 5)            // Sort from the 5th Element On

     FT_ADESSORT(aNames, , 10)         // Sort the 1st 10 Elements

     FT_ADESSORT(aNames, 5, 10)        // Sort Elements 5-10

 Source: ADESSORT.PRG

 Author: David Husnian

 


FT_AAVG

FT_AAVG()
 Average numeric values in an array

 Syntax

      FT_AAVG( <aArray> [, <nStartIndex> [, <nEndIndex> ] ] ) -> nAverage

 Arguments

     <aArray> is the array containing the elements to be averaged.

     <nStartIndex> is the first array item to include,
     defaults to first element.

     <nEndIndex> is the last array element to include,
     defaults to all elements.

 Returns

     The average of the specified array elements.

 Description

     This function is used to get a numeric average of selected or all
     elements of an array.

     This routine requires FT_ASUM().

 Examples

     FT_AAVG(aSubTotals)          // Get Average of Entire Array

     FT_AAVG(aSubTotals, 5)       // Get Average of 5th Element On

     FT_AAVG(aSubTotals, , 10)    // Get Average of 1st 10 Elements

     FT_AAVG(aSubTotals, 5, 10)   // Get Average of Elements 5-10

 Source: AAVG.PRG

 Author: David Husnian