Set Up Housekeeping

‘HOUSEKEEPING’

1.1 Applying housekeeping to database tables Each table can have ‘housekeeping’ rules applied to it however a common sense approach needs to be take – ie: applying rules to maintenance tables that have other screens dependant on their historical data needs to be carefully considered. If there is very little ‘space’ to be gained by removing the ‘old’ records then do not apply the rules. The transactional tables are the candidates for having their data purged or archived. The following tables are recommended:

  • Ta_clock_trans_import – use import_datetime field
  • Ta_generated_rosters – use shift_start_date field
  • Ta_clocking_exceptions - use import_datetime field
  • Ta_clock_comms_log – use action_date field
  • Ta_import_leave_balances - use import_datetime field
  • Ta_employee_preliminary (if importing employees from a payroll or human resources system)
  • Ta_history_[various tables]
  • Ta_import_[various tables]
  • Ta_cost_[various tables]
  • Ta_forecast_[various tables]
  • Ta_employee_attend_alloc
  • Ta_employee_attend_costing
  • Ta_employee_attendance_bank
  • Ta_resource_plan
  • Im_[various tables] ** these are import tables currently used by Empower
  • Au_[various tables] ** these are the audit tables

When you select a table you have the option to: a) Archive the data to a nominated file. This data can be loaded back into the database at a later date if required b) Purge the data – this permanently removes the data from the table and server You must select 1 or more columns to base the archive on. Typically this will be a date field and you will enter the number of weeks to retain in the database. You may choose to check a different value, such as a deleted indicator and apply the rule if it is set to TRUE (1), or a combination of values. The housekeeping logic will apply its’ rules to any records that meet the defined criteria.

Screenshot

In the above screenshot the housekeeping will archive data from the ta_clock_trans_import into the C:\mwp\database\mwpsource\ta_clock_trans_import.txt file if the clock_datetime value is more than 4 weeks old ie: it retains the last 4 weeks of data.

1.2 Applying housekeeping to the file system MyWorkplace reads and writes files from and to the server. These may be report files, clocking import files, export interface files, import interface files, or general log files. To contribute to ensuring the file system is adequately maintained MyWorkplace has the facility to define Housekeeping rules for the data files it reads and writes. By entering the directory path and file name into the screen you are nominating the files that match the criteria to be purged from the system. Note: it can be a partial file name however you must identify whether the files to be purged ‘Starts With’, ‘Contains’, or ‘Ends With’, or ‘Equals’ entered filename text. Use the Match Selection drop down list to select the appropriate option. By ticking the Apply To Sub-Folder option the system will also look at ALL folders / directories beneath the Directory path that has been entered and purge the matching files. This is extremely useful for reports where the sub folders will be the users names or payroll interface files where there are multiple pay groups and each pay group is written to a different folder beneath the parent folder. This allows the housekeeping rule to be defined once and applied to all. The Days To Keep identifies the date checking to be applied. If the date against the file is younger than or equal to the entered value it will be retained and if it is older it will be purged.

Screenshot

2 Setting up the Housekeeping to run automatically To run the Housekeeping automatically the following must be completed: a) Create a batch file to run MyWorkplace with the module=H b) Create a Scheduled Task on the server to run the batch file as per the defined schedule.

3 NOTES: 4 BEFORE activating the Housekeeping it is advised to backup the database first in case any rules are incorrectly defined and data needs to be recovered. 5 When the Archiving/Purging process is first setup on a database with potentially large amounts of data to be deleted from Tables, you should cater for a number of smaller amounts of data to be processed, until the processing is up to date. E.g. If there are 6 years of data in ‘ta_clock_trans_import’, do not attempt to reduce this to keep just the latest 3 months in one run. You should run a number of smaller deletes to achieve the required status. This can initially be achieved by the Housekeeping process, or running SQL. Then the scheduled housekeeping process will maintain the required level of data. If you need assistance with this, please ask for help.