Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List of files opened
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00540256
Message ID:
00540294
Views:
20
Robert,

The AUSED() function will probably do what you need. It creates a two-dimensional array storing the alias in the first column and workarea in the second. Use DBF() to get the table name of the alias.

The TABLELIST() function below will return an array consisting of the alias and full path table name of every table open in the current data session, or an empty array if no tables are open.
FUNCTION TABLELIST( aTableArray )

LOCAL lnI, lnCount

lnCount = AUSED( aTableArray )

IF lnCount > 0

    FOR lnI = 1 TO lnCount
        aTableArray[ lnI, 2 ] = DBF( aTableArray[ lnI, 1 ] )
    NEXT

ENDIF

RETURN lnCount
The function is called passing an array by reference. For example:
USE c:\VFP\data\myTable ALIAS myAlias
USE c:\VFP\data\myTable ALIAS myOtherAlias AGAIN

DIMENSION myArray(1)

*   Pass the array by reference with the "@" operator
IF TABLELIST( @myArray ) > 0

    ? myArray[ 1, 1 ]  -> "myAlias"
    ? myArray[ 1, 2 ]  -> "c:\VFP\data\myTable"
    ? myArray[ 2, 1 ]  -> "myOtherAlias"
    ? myArray[ 2, 2 ]  -> "c:\VFP\data\myTable"

ENDIF
Regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Reply
Map
View

Click here to load this message in the networking platform