||Re: table empty
Mervyn Bick <email@example.com>
||Tue, 30 Jun 2020 10:03:11 +0200
On 2020-06-30 07:23, Tony wrote:
> I have a table called Batch.dbf - When I put data into this table and then print the data for the "Batcher", I need to empty the table for the next data entry as the information is different - How do I empty the table after printing has finished ?
> I am printing from code ?? etc not with the dBase reporter. I have tried from Ken's book but just can't seem to get it. Thanks
You can ZAP batch.dbf at any time after you have printed your report.
This marks all the records as deleted so they won't print but it doesn't
physically empty the table. This means that although there are no
records to print the table is still taking space on the disk. If you
repeatedly ZAP a table it can grow quite big even though there seems to
be nothing in it. To physically remove deleted records from a table you
need to PACK it.
//the code that prints your report.
zap //Marks all records as deleted. They will no longer print.
set safety off //Without this you will have to permit the PACK manually.
use batch exclusive //This will close and reopen batch.
pack //Physically empties the table.
set safety on //Not needed if safety is not set off.
use //This will close the empty table.
Even if you are using a query object to read batch.dbf for your report
you could use the code above in a little program to empty batch.dbf.
The query object must, however, be made inactive first so that dBASE can
get exclusive use of the table.
Where are you getting the data from to populate batch.dbf? It may be
possible to print direct from your permanent tables without the
intermediate step of creating batch.dbf.