Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>afields()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
AFIELDS()


Syntax:     AFIELDS([<array1> [,<array2> [, <array3> [,<array4>]]]])

Purpose:    To fill a series of arrays with fieldnames, field types,
            field lengths, and field decimals.

Arguments:  <array1> is the array to fill with fieldnames.  Each
            element is character type.

            <array2> is the array to fill with the type of fields in
            <array1>.  Each element is character type.

            <array3> is the array to fill with the widths of fields
            in <array1>.  Each element is numeric type.

            <array4> is the array to fill with the number of
            decimals defined for fields in <array1>.  Each element is
            numeric type.  If the field type is not numeric, the element
            is zero.

Returns:    An integer numeric value.

            AFIELDS() returns the number of fields or the length of the
            shortest array argument, whichever is less.  If no
            parameters are specified, AFIELDS() returns zero.

Usage:      AFIELDS() fills a series of arrays with the attributes of
            fields from the current work area and returns the number of
            elements filled with field information.  If there is no
            database file in USE, AFIELDS() returns zero.

            To fill arrays for some attributes while ignoring others,
            pass a dummy variable.  For example, to obtain the
            fieldnames and corresponding field lengths only:

            DECLARE fname[FCOUNT()], flen[FCOUNT()]
            dummy = ""
            AFIELDS(fname, dummy, flen)

Library:    EXTEND.LIB


----------------------------------- Examples -------------------------------

   The following demonstrates how to use AFIELDS() and ACHOICE() to
   create and select from a fields list:

   CLEAR
   USE Sales
   *
   DECLARE fname[FCOUNT()]
   AFIELDS(fname)
   @ 1,0 TO 10,10 DOUBLE
   fld = ACHOICE(2, 1, 9, 9, fname)
   @ 12, 0 SAY IF(fld <> 0, fname[fld],;
      "None selected")
   RETURN


See Also: ACHOICE() ADIR() ASCAN() ASORT() FIELD() LEN()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson