ASessions()
This is a function that was sorely missed in VFP 6 and earlier versions. Added in VFP 7, it fills an array with the list of data sessions in use.
Usage |
nSessionCount = ASESSIONS( aSessionList ) |
Parameter |
Value |
Meaning |
aSessionList |
Array |
An array to hold the list of sessions. The array is created if it doesn't already exist and resized if it does. The resulting array is one-dimensional. |
nSessionCount |
Numeric |
The number of open data sessions. |
Example |
* You're most likely to use the results of * ASessions() to drive a loop. LOCAL nOldSession LOCAL nSessionCount, aSessionList[1], nSession LOCAL nTableCount, aTables[1], nTable nOldSession = SET("DATASESSION") nSessionCount = ASESSIONS( aSessionList ) FOR EACH nSession in aSessionList * Switch sessions SET DATASESSION TO nSession * Get a list of open tables. nTableCount = AUSED( aTables ) * Do something for each data session, like ROLLBACK FOR nTable = 1 TO nTableCount * Do something with each table, like TABLEREVERT(). WAIT WINDOW ALIAS( nTable ) ENDFOR ENDFOR * Return to original data session SET DATASESSION TO (nOldSession) |
See Also |