How do I delete workbooks older than 4 years

Hi ronandcol, as far as I know, there is no feature function like this build in. You could try on your own risc the following, that should work.

  1. Make a database backup. Go to settings → save database → choose a folder you find the backup later
  2. Copy the following SQL script into an empty textfile (on Windows you could open a new file with e.g. wordpad etc.) and save the file for excample with the name “tb_remove_data_older_4years.txt” on your device.
DELETE FROM exceptions WHERE date2 <= DATE('now', '-48 month');
DELETE FROM lmm_assignment WHERE date <= DATE('now', '-48 month');
DELETE FROM lmm_meeting WHERE date <= DATE('now', '-48 month');
DELETE FROM lmm_schedule WHERE date <= DATE('now', '-48 month');
DELETE FROM lmm_schedule_assist WHERE date <= DATE('now', '-48 month');
DELETE FROM notes WHERE date <= DATE('now', '-48 month');
DELETE FROM outgoing WHERE date <= DATE('now', '-48 month');
DELETE FROM publicmeeting WHERE date <= DATE('now', '-48 month');
DELETE FROM publictalks_todolist WHERE date <= DATE('now', '-48 month');
DELETE FROM school_break WHERE date <= DATE('now', '-48 month');
DELETE FROM school_schedule WHERE date <= DATE('now', '-48 month');
DELETE FROM serviceMeeting WHERE date <= DATE('now', '-48 month');
DELETE FROM student_studies WHERE start_date <= DATE('now', '-48 month');
DELETE FROM unavailables WHERE end_date <= DATE('now', '-48 month');
  1. In TheocBase Settings click the button in the bottom-right corner, that says on mouse hover “Run a file provided by the Help Desk”
  2. Confirm the safety warning
  3. Choose the file you saved on your device (“tb_remove_data_older_4years.txt”)
  4. Confirm possibly error messages popping up and at least the final ok message

Thats it. All data older than 4 years (48 months) is gone. Check if everything runs well, also after new start of TheocBase. You also could change all the numbers in the script (-48) to a number you lilke, but it should be the same number in all rows. If anything goes wrong recover your database in settings with the backup you saved before.

Good luck :wink:

1 Like