ARRAY

Name

ARRAY -- 

Function

NIL                 A2EDIT(<nTop>, <nLeft>, <nBottom>, <nRight>, <aData>, <cUserFunc>, <aSay>, <aHeaders>, <aHeadSep>, <aColSep>, <aFootSep>, <aFooters>)
Value               AADD(<aTarget>, <expValue>[, <keyValue>])
aDuplicate          ACLONE(<aSource>)
aTarget             ACOPY(<aSource>, <aTarget>, [<nStart>], [<nCount>], [<nTargetPos>])
aTarget             ADEL(<aTarget>, <nPosition>)
aArray              AEVAL(<aArray>, <bBlock>, [<nStart>], [<nCount>])
aTarget             AFILL(<aTarget>, <expValue>,[<nStart>], [<nCount>])
aTarget             AINS(<aTarget>, <nPosition>)
aArray              ARRAY(<nElements> [, <nElements>...])
<nStoppedAt>        ASCAN(<aArr>, <Expression>, [<nStart>], [<nCount>], [lBack])
aTarget             ASIZE(<aTarget>, <nLength>)
aTarget             ASORT(<aTarget>, [<nStart>],[<nCount>], [<bOrder>])
Element             ATAIL(<aArray>)
aDirectory          DIRECTORY(<cDirSpec>, [<cAttributes>])
lEmpty              EMPTY(<exp>)
<aSelected>         __Fledit( <aSrc>, <aList>)
aNewArray           FT_AADDITION( <aList1>, <aList2> [, <lTrimmer> [, <lCaseSens> ] ] ) ;
nAverage            FT_AAVG( <aArray> [, <nStartIndex> [, <nEndIndex> ] ] )
aSorted             FT_ADESSORT( <aArray> [, <nStartIndex> [, <nEndIndex> ] ] )
nMaxlen             FT_AEMAXLEN( <aArray> [, <nDimension> [, <nStart> [, <nCount> ] ] ] ) ;
nMinlen             FT_AEMINLEN( <aArray> [, <nDimension> [, <nStart> [, <nCount> ] ] ] )
nMedian             FT_AMEDIAN( <aArray> [, <nStart> [, <nEnd> ] ] )
nNoOfMatches        FT_ANOMATCHES( <aArray>, <bCompareBlock> ; [, <nStartIndex> [, <nEndIndex> ] ] )
xElement            FT_AREDIT( <nTop>, <nLeft>, <nBottom>, <nRight>, <Array Name>, ; <nElem>, <aHeadings>, <aBlocks> [, <bGetFunc> ] )
nSum                FT_ASUM( <aArray> [, <nStartIndex> [, <nEndIndex> ] ] )
aArray              FT_RESTARR( <cFileName>, <nErrorCode> )
lRet                FT_SAVEARR( <aArray>, <cFileName>, <nErrorCode> )
nCount              LEN(<cString> | <aTarget>)
<oObject>           MAP()
<lOldMode>          MAPMODIFY(<oObj>, <lMode>)
cType               TYPE(<cExp>)
cType               VALTYPE(<exp>)

Description

Function A2EDIT()

  A2EDIT(<nTop>, <nLeft>, <nBottom>, <nRight>, <aData>, <cUserFunc>, <aSay>, <aHeaders>, <aHeadSep>, <aColSep>, <aFootSep>, <aFooters>) --> NIL
 

A2EDIT() is a array function that determines the browse 2D array data in a table layout.

A2EDIT() lake a DBEDIT() function.

Function AADD()

 AADD(<aTarget>, <expValue>[, <keyValue>]) --> Value

AADD() is an array function that increases the actual length of the target array by one. The newly created array element is assigned the value specified by <expValue>.

AADD() is used to dynamically grow an array. It is useful for building dynamic lists or queues. A good example of this is the GetList array used by the Get system to hold Get objects. After a READ or CLEAR GETS, GetList becomes an empty array. Each time you execute an @...GET command, the Get system uses AADD() to add a new element to the end of the GetList array, and then assigns a new Get object to the new element.

AADD() is similar to ASIZE() but only adds one element at a time; ASIZE() can grow or shrink an array to a specified size. AADD(), however, has the advantage that it can assign a value to the new element, while ASIZE() cannot. AADD() may also seem similar to AINS(), but they are different: AINS() moves elements within an array, but it does not change the array's length.

Note: If <expValue> is another array, the new element in the target array will contain a reference to the array specified by <expValue>.

Function ACLONE()

 ACLONE(<aSource>) --> aDuplicate

ACLONE() is an array function that creates a complete duplicate of the <aSource> array. If <aSource> contains subarrays, ACLONE() creates matching subarrays and fills them with copies of the values in the <aSource> subarrays. ACLONE() is similar to ACOPY(), but ACOPY() does not duplicate nested arrays.

Function ACOPY()

  ACOPY(<aSource>, <aTarget>,
 [<nStart>], [<nCount>], [<nTargetPos>]) --> aTarget
 
 

ACOPY() is an array function that copies elements from the <aSource> array to the <aTarget> array. The <aTarget> array must already exist and be large enough to hold the copied elements. If the <aSource> array has more elements, some elements will not be copied.

ACOPY() copies values of all data types including NIL and code blocks. If an element of the <aSource> array is a subarray, the corresponding element in the <aTarget> array will contain a reference to the subarray. Thus, ACOPY() will not create a complete duplicate of a multidimensional array. To do this, use the ACLONE() function.

Function ADEL()

 ADEL(<aTarget>, <nPosition>) --> aTarget

ADEL() is an array function that deletes an element from an array. The contents of the specified array element is lost, and all elements from that position to the end of the array are shifted up one element. The last element in the array becomes NIL.

Warning! xClipper implements multidimensional arrays by nesting arrays within other arrays. If the <aTarget> array is a multidimensional array, ADEL() can delete an entire subarray specified by <nPosition>, causing <aTarget> to describe an array with a different structure than the original.

Function AEVAL()

  AEVAL(<aArray>, <bBlock>,
 [<nStart>], [<nCount>]) --> aArray
 
 

AEVAL() is an array function that evaluates a code block once for each element of an array, passing the element value and the element index as block parameters. The return value of the block is ignored. All elements in <aArray> are processed unless either the <nStart> or the <nCount> argument is specified.

AEVAL() makes no assumptions about the contents of the array elements it is passing to the block. It is assumed that the supplied block knows what type of data will be in each element.

AEVAL() is similar to DBEVAL() which applies a block to each record of a database file. Like DBEVAL(), AEVAL() can be used as a primitive for the construction of iteration commands for both simple and complex array structures.

Refer to the Code Blocks section in the "Basic Concepts" chapter of the Programming and Utilities Guide for more information on the theory and syntax of code blocks.

Function AFILL()

 AFILL(<aTarget>, <expValue>,[<nStart>], [<nCount>]) --> aTarget

AFILL() is an array function that fills the specified array with a single value of any data type (including an array, code block, or NIL) by assigning <expValue> to each array element in the specified range.

Warning! AFILL() cannot be used to fill multidimensional arrays. xClipper implements multidimensional arrays by nesting arrays within other arrays. Using AFILL() with a multidimensional array will overwrite subarrays used for the other dimensions of the array.

Function AINS()

 AINS(<aTarget>, <nPosition>) --> aTarget

AINS() is an array function that inserts a new element into a specified array. The newly inserted element is NIL data type until a new value is assigned to it. After the insertion, the last element in the array is discarded, and all elements after the new element are shifted down one position.

Warning! AINS() must be used carefully with multidimensional arrays. Multidimensional arrays in xClipper are implemented by nesting arrays within other arrays. Using AINS() in a multidimensional array discards the last element in the specified target array which, if it is an array element, will cause one or more dimensions to be lost. To insert a new dimension into an array, first add a new element to the end of the array using AADD() or ASIZE() before using AINS().

Function ARRAY()

 ARRAY(<nElements> [, <nElements>...]) --> aArray

ARRAY() is an array function that returns an uninitialized array with the specified number of elements and dimensions. If more than one <nElements> argument is specified, a multidimensional array is created with the number of dimensions equal to the number of <nElements> arguments specified. Any <nElements> that is itself an array creates a nested array.

In xClipper, there are several ways to create an array. You can declare an array using a declaration statement such as LOCAL or STATIC; you can create an array using a PRIVATE or PUBLIC statement; you can assign a literal array to an existing variable; or you can use the ARRAY() function. ARRAY() has the advantage that it can create arrays within expressions or code blocks.

Function ASCAN()

 ASCAN(<aArr>, <Expression>, [<nStart>], [<nCount>], [lBack])	--> <nStoppedAt>

ASCAN() scanns an array <aArr> for a value <Expression> or until a code block <Expression> returns TRUE and uses for comparions operator (=).

Function ASIZE()

 ASIZE(<aTarget>, <nLength>) --> aTarget

ASIZE() is an array function that changes the actual length of the <aTarget> array. The array is shortened or lengthened to match the specified length. If the array is shortened, elements at the end of the array are lost. If the array is lengthened, new elements are added to the end of the array and assigned NIL.

ASIZE() is similar to AADD() which adds a single new element to the end of an array and optionally assigns a new value at the same time. Note that ASIZE() is different from AINS() and ADEL(), which do not actually change the array's length.

Note: ASIZE() only supports single-dimensional arrays.

Function ASORT()

 ASORT(<aTarget>, [<nStart>],[<nCount>], [<bOrder>]) --> aTarget

ASORT() is an array function that sorts all or part of an array containing elements of a single data type. Data types that can be sorted include character, date, logical, and numeric.

If the <bOrder> argument is not specified, the default order is ascending. Elements with low values are sorted toward the top of the array (first element), while elements with high values are sorted toward the bottom of the array (last element).

If the <bOrder> block argument is specified, it is used to determine the sorting order. Each time the block is evaluated, two elements from the target array are passed as block parameters. The block must return true (.T.) if the elements are in sorted order. This facility can be used to create a descending or dictionary order sort. See the examples below.

When sorted, character strings are ordered in ASCII sequence; logical values are sorted with false (.F.) as the low value; date values are sorted chronologically; and numeric values are sorted by magnitude.

Function ATAIL()

 ATAIL(<aArray>) --> Element

ATAIL() is an array function that returns the highest numbered element of an array. It can be used in applications as shorthand for <aArray>[LEN(<aArray>)] when you need to obtain the last element of an array.

Function EMPTY()

 EMPTY(<exp>) --> lEmpty

The EMPTY() function has a number of uses. You can use it to determine if a user entered a value into a Get object before committing changes to a database file. It can also determine whether a formal parameter is NIL or unsupplied. In addition, it can test an array for zero-length.

Function __FLEDIT()

 __Fledit( <aSrc>, <aList>) --> <aSelected>

__FlEdit() searches each element of <aList>[1] (DBS_NAME) in <aSrc>. If the element is found, this element of <aSrs> is added to destination array <aSelected>. According of other subelements (DBS_TYPE, DBS_LEN, DBS_DEC) isn't checked. Categories TCP is the set of functions for work with sockets.

For functions TCPListen() and TCPAccept() many thanks to Sergio Zayas.

Function FT_AADDITION()

 FT_AADDITION( <aList1>, <aList2> [, <lTrimmer> [, <lCaseSens> ] ] ) ;
 --> aNewArray

This function will add the elements unique of aList2 with aList1. It returns a new array including all the elements of aList1 plus the unique elements of aList2.

Function FT_AAVG()

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

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

This routine requires FT_ASUM().

Function FT_ADESSORT()

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

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

Function FT_AEMAXLEN()

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

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

Function FT_AEMINLEN()

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

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

Function FT_AMEDIAN()

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

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.

Function FT_ANOMATCHES()

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

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.

Function FT_AREDIT()

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

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.

Function FT_ASUM()

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

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

Function FT_RESTARR()

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

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.]

Function FT_SAVEARR()

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

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.]

Function LEN()

 LEN(<cString> | <aTarget>) --> nCount

LEN() is a character and array function that returns the length of a character string or the number of elements in an array. With a character string, each byte counts as one, including an embedded null byte (CHR(0)). By contrast, a null string ("") counts as zero.

For an array, LEN() returns the number of elements. If the array is multidimensional, subarrays count as one element. This means that the LEN() of a nested or multidimensional array simply returns the length of the first dimension. To determine the number of elements in other dimensions, use LEN() on the subarrays as shown in the example below. Note that nested arrays in xClipper need not have uniform dimensions.

Function MAP()

 MAP() 	--> <oObject>

MAP() createst new empty object (associative array) and returns it.

Function MAPMODIFY

 MAPMODIFY(<oObj>, <lMode>) 	--> <lOldMode>

MAPMODIFY() includes/excludes the control mode for attributes when this attributes try changes.

If <lMode> is TRUE and source object <oObj> contents method <Modify>, then before changes attributes value automatically called method oObj:Modify(<nHashAttr>, <vNewValue>). When <nHashAttr> is the attribute hash code, <vNewValue> new value, what must be assigned. The <Modify> method must returned realy value for modifyed attribute.

Function TYPE()

 TYPE(<cExp>) --> cType

TYPE() is a system function that returns the type of the specified expression. It can test expression validity as long as the expression uses xCLIPPER.LIB functions and does not reference local or static variables, user-defined functions, or built-in functions supplied in EXTEND.LIB.

TYPE() is like VALTYPE() but uses the macro operator (&) to determine the type of the argument. This precludes the use of TYPE() to determine the type of local and static variables. VALTYPE(), by contrast, evaluates an expression and determines the data type of the return value. This lets you determine the type of user-defined functions as well as local and static variables.

Function VALTYPE()

 VALTYPE(<exp>) --> cType

VALTYPE() is a system function that takes a single argument, evaluates it, and returns a one-character string describing the data type of the return value. It is similar to TYPE(), but differs by actually evaluating the specified argument and determining the type of the return value. For this reason, you can determine the type of local and static variables, user-defined functions, and EXTEND.LIB functions. TYPE(), by contrast, uses the macro operator (&) to evaluate the type of its argument. Note that if the argument does not exist, an error ("undefined error") will occur, unlike TYPE which will return "U."