Page 1 of 1

clearing of archives

PostPosted: Thu Jan 20, 2022 8:51 am
by Silvio.Falconi
In a conversion procedure I have to clear all the archives and then populate them during the conversion.
The archives were all opened with Tdatabase and therefore in share
Archives are indexed with the! Deleted () clause
I don't know how to do the zeroing of archives and the dbpack since it cannot be done in Tdatabase
I don't know if it is better to delete all the archives and create them again or there is another solution

Re: clearing of archives

PostPosted: Thu Jan 20, 2022 8:58 am
by Marc Venken
Are the new archives also changed in structures ?
ntx to cdx ? or also the same ?

Re: clearing of archives

PostPosted: Thu Jan 20, 2022 9:56 am
by Silvio.Falconi
The application that I am putting in place serves to make the substitutions of teachers every morning, I am changing it because we have decided to transform it into a network with user management.

Initially to use the procedure it was necessary to insert the data in all the archives (teachers, classes, classrooms, lessons etc.), to avoid entering everything from scratch because it is unnerving, I created a conversion procedure from an Excel archive that is generally used in all schools that automatically and in a short time extracts the data and puts them in the archives.

Then I proceed to convert from Excel to an import.dbf (oImport) archive

Then from this oImport archive I have to populate a series of archives (classes, classrooms, teachers, timetables, lessons, subjects, groups) through a procedure created by me, but the archives must be empty., And then the indexes must be recreated.

Probably this operation must be done by only one and not the shares, so before loading the conversion procedure I have to check if the users have logged out of the system. and only then can I call up the procedure and open the archives exclusively.

how should i check if a user is inside the system?
I have to check the user archive and the TAbations archive to see if there is a user who has entered the system
If there is someone I send a message "You must exit the system" through a procedure of messages between users of the same program and then I have to proceed and then I can use the archives in exclusive mode and use pack and zap.

Are there any other solutions?

Re: clearing of archives

PostPosted: Thu Jan 20, 2022 10:15 am
by Marc Venken
I would concider

Make a conversion folder (for putting temporary dbf)
from the program folder copy the needed dbf's with the copy structure command to conversion folder (dbf's will be empty but have all fields)
fill the dbf in the conversion folder and generate the index file's
see if you have all users logged out and copy the files back to program folder. This process will be quick
This process could also be done timed ex. at 04.00 am so there is no one on the system.

The same can also be done in the program directory but there you can use the ZAP command or function.

Re: clearing of archives

PostPosted: Fri Jan 21, 2022 6:57 am
by Jimmy
hi,

i do create DBF / Index if not exist ...

you can open a DBF EXCLUSIVE when NO User is Connect ... than you can Ferase() it
to find out "who" is Connect to DBF is another Question

Re: clearing of archives

PostPosted: Sun Jan 30, 2022 5:39 pm
by nageswaragunupudi
I don't know how to do the zeroing of archives and the dbpack since it cannot be done in Tdatabase


if the table is open exclusively,

oDbf:Zap()
oDbf:Pack()