laWkAreas will be an 2 Dimensional array where,
laWkAreas[x,1] is the table/cursor name and
laWkAreas[x,2] is the workarea that it is open in
example:
[tt]
* Note: there are 32767 selectable work areas as of VFP 6.0
LOCAL lnWkAreas
LOCAL ARRAY laWkAreas[1]
lnWkAreas = AUSED(laWkAreas)
IF lnWkAreas > 0
* Note: Cursors can have names up to 128 chars
CREATE CURSOR OpenWkAreas (tablename c(128), wkarea N(5))
FOR i = 1 TO lnWkAreas
INSERT INTO OpenWkAreas ;
(tablename,wkarea) ;
VALUES ;
(laWkAreas[i,1],laWkAreas[i,2])
NEXT
LOCAL oForm
oForm = CREATEOBJECT("MyForm"
oForm.SHOW()
READ EVENTS
ENDIF
DEFINE CLASS MyForm AS FORM
DOCREATE = .T.
AUTOCENTER = .T.
CAPTION = "Open tables and work areas"
ADD OBJECT grdWkAreas AS GRID WITH;
TOP = 10, ;
LEFT = 10, ;
HEIGHT = THIS.HEIGHT - 20, ;
WIDTH = THIS.WIDTH - 30
PROCEDURE DESTROY
CLEAR EVENTS
ENDPROC
PROCEDURE grdWkAreas.INIT
* Calculate column widths
* based upon field value widths
LOCAL lnMaxColWidth, i
lnMaxColWidth = 0
GO TOP IN (THIS.RECORDSOURCE)
SCAN
IF EVAL( ;
THIS.COLUMNS(1).text1.CONTROLSOURCE) <> ;
THIS.RECORDSOURCE
I will try to explain it.
I wont to know total count of all areas that contain some table or cursor.
For example: Program use 3 tables and 2 cursors. I wont to know how can I get number 5???
I dont wanna browse through all of 32767.
Exist some function?
In fact, if you only want to know the number of work areas that contain a cursor or table, just take the value returned from AUSED(). You can discard the array.
Keep in mind that AUSED() only operates on the current datasession.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.