Hi friends,
How can i get a list of all databases currently openend.
Alias() returns the alias of the current work area.
But is there a function to get an array of all opened databases or another way to retrieve this list ?
Theo
Get list of WorkAreas or Aliases
Moderator: Rathinagiri
- serge_girard
- Posts: 3161
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Get list of WorkAreas or Aliases
Hi Theo !
Try this:
Serge (see you soon!)
Try this:
Code: Select all
FOR x := 1 TO 55
SELECT( x )
IF !EMPTY( ALIAS(x) )
? SELECT()
? ALIAS()
? RECNO()
? DBFILTER()
? DBRELATION()
? INDEXORD()
? INDEXKEY( INDEXORD() )
ENDIF
NEXT
There's nothing you can do that can't be done...
Re: Get list of WorkAreas or Aliases
Hi Theo,
Yes, it is exist.
Please take a look for the following code snippet:
Code: Select all
LOCAL aAlias := {}
LOCAL cur_id
LOCAL nOldArea := Select()
hb_WAEval( {|| AAdd( aAlias, { Select(), Alias() } ) } )
IF Len( aAlias ) == 0
Alert( "No workareas in use" )
RETURN
ENDIF
IF ( cur_id := AScan( aAlias, {| x | x[ 1 ] == nOldArea } ) ) == 0
cur_id := 1
dbSelectArea( aAlias[ 1 ][ 1 ] )
ENDIF
...
dbSelectArea( nOldArea )
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: Get list of WorkAreas or Aliases
Serge, Grigory,
Thanks !
Theo
Thanks !
Theo