I have a standard in-memory table (defined in DCT) and a standard ABC Browse box on it.
When I load a window I load data manually to it and it works. But I need to load different data depending on settings from the same window - so I need to re-load my table. and so I need to empty/delete the table somehow quickly.
the standard loop takes awhile
clear(pre:record)
set(table)
LOOP
NEXT(table)
IF ERRORCODE() THEN BREAK.
DELETE(table)
.
so is there any way to delete all records (empty) in-Memory table that is currently used in BrwoseBox??
I always just looped backwards through the file. That way you don’t have to worry about having exclusive access, and it’s pretty dang fast anyway. But if this is something you do a lot, maybe it’s worth the effort to get exclusive access (closing the file in every thread first).
I would like to know if EMPTY was tested and worked?
The Docs have an example that show the file Must Be OPEN(,18) as 18=12h= DenyAll + ReadWrite so exclusive. This is the same for disk TPS. Elsewhere it mentions Open Mode is used to “enforce access between threads”. So you probably must Close and Open.
63 = Exclusive Required. It must not have closed, you could check Status(File)
Do you just need the file on 1 thread?
Then you could set templates to always Open(,12h) exclusive so EMPTY would work. You specify /THREADEDCONTENT i.e. DRIVER('Memory', '/THREADEDCONTENT’) and each thread gets its own instance.
I would still leave your existing Loop ; Next ; Delete code after EMPTY() in case the Open changed.