Click or drag to resize

AUsed Function

-- todo --
Places table aliases and work areas for a data session into a variable array.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Request Example View Source


ArrayName (Optional)
Type: Usual
Specifies the name of the array containing the table aliases and work areas for a data session.
nDataSessionNumber (Optional)
Type: Usual
Specifies the data session number for which AUsed( ) returns the table aliases and work areas. If you omit nDataSessionNumber, AUsed( ) returns information about the current data session. Use Set DATASESSION to specify the current data session.
cTableName (Optional)
Type: Usual
The array will only contain aliases of the table specified with cTableName.

Return Value

Type: Usual
If the array you specify does not exist, X# automatically creates the array. If the array exists and is not large enough to contain all the table aliases and work areas, X# automatically increases the size of the array. If the array is larger than necessary, X# truncates the array. If the array exists, and AUsed( ) returns 0 because no tables are open in the data session, the array remains unchanged. If the array does not exist, and AUsed( ) returns 0, the array is not created.

The current data session is used if you set nDataSessionNumber to the null value (.NULL.).
cTableName can be in the following formats, listed in the order in which X# searches for tables.

    AUsed( ) returns the number of rows in the array, which is identical to the number of tables open in the data session.

    AUsed( ) creates a two-dimensional array and places the aliases of tables open for the data session in the first column of the array. The second column of the array contains the tables' corresponding work area numbers.
    The table aliases are placed into the array in reverse order that they were opened in. For example, the first array element contains the alias of the last table opened, and the last array element contains the alias of the first table opened. This ordering is useful when using TableUpdate( ) on views that contain views. For example:
    1For x = 1 TO AUsed(aTableAliases,1)
    2IF CursorGetProp( "Buffering", aTableAliases(x) ) > 1 // Buffered
    3? TableUpdate( 0, .T., aTableAliases(x) )
1Open Database (HOME(2) + 'Data\testdata') EXCLUSIVE
2Use Customer IN 0
4? AUsed(gaInuse)
5Display MEMORY LIKE gaInuse
6Close Databases
See Also