[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FUNCTION A2TOSING()

  Short:
  ------
  A2TOSING() Copies a given element from an array of arrays

  Returns:
  --------
  <aSingle> => a single dimensioned array

  Syntax:
  -------
  A2TOSING(a2Dim,nElement)

  Description:
  ------------
  Copies a given element position from a 2 dimensioned
  array of arrays into a single dimensioned array. <a2dim> is the
  source 2 dimensioned array. <nElement> is the element position
  within each sub-array to copy.

  Examples:
  ---------
  Both DBSTRUCT() and DIRECTORY() are good examples.
  Each return an array of arrays. DBSTRUCT() for instance, returns
  the structure of the current database file in an array whose
  length is equal to the number of fields in the database file.
  Each element of the array is a subarray containing information
  for one field.  The subarrays have the following format:

        { fieldname, fieldtype, fieldlength,fielddecimals}

  To extract a single dimensioned array of, say, the
  field names, you could use A2TOSING() with
  A2TOSING(DBSTRUCT(),1). For the field types you would use
  A2TOSING(DBSTRUCT(),2), etc.

  Here is an example with DIRECTORY()

   aDir         := DIRECTORY()
   aNames       := A2TOSING(adir,1)
   nWhichFile   := mchoice(aNames,10,10,20,20,"Which File?")

  Source:
  -------
  S_AFTYPE.PRG


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson