Subject Re: table empty
From Mervyn Bick <invalid@invalid.invalid>
Date Tue, 30 Jun 2020 10:03:11 +0200
Newsgroups dbase.getting-started

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.


use batch
//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.

Mervyn.





Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0