Table of Contents

Data Cleanup

With every posted document, sent e-mail, or aborted scan session, your database grows — that is normal. But not all of this data has to be kept forever. Old logs, finished sessions, and processed messages can be removed safely after a while. Data Cleanup lets you decide, per table, which records may be deleted automatically once they reach a certain age.

Keeping your database lean keeps 3PL Dynamics fast and reliable. For example, a large number of old, incorrectly closed scan sessions can cause problems when an employee resumes an old session, and integration (EDI) messages that contain print documents can quietly inflate your database if they are never cleaned up.

Note

Data Cleanup replaces the older Cleanup Setup (now shown as Cleanup Setup (old)). If you still use the old setup, move your configuration to the new Data Cleanup Setup. The old page will point you to the new one.

Data Cleanup Setup in 3PL Dynamics

Everything is configured from two pages:

  • Data Cleanup Setup (list) — the overview of every table that can be cleaned up, grouped per application area. This is where you enable the tables you want to clean and see their status at a glance.
  • Data Cleanup Setup (card) — opened from a line in the list. Here you fine-tune how a single table is cleaned: how long records are kept, which date decides a record's age, and whether to use one rule for the whole table or several rules for parts of it.

Application areas

Every table belongs to an Application Area so you can find and filter tables per module:

Area What it covers Details
Core Generic platform data: e-mail, document handling, integration (EDI) messages, logs, status, scanning, invoicing. Core tables
WMS Warehousing: warehouse documents, activities, packaging, storage costs, carriers. WMS tables
TMS Transportation: planning, freight calculations, on-board-computer (OBC) messages. TMS tables
Customs Customs orders and declarations. Customs tables
Tip

On any line in the Data Cleanup Setup list you can click Learn more (the same button opens on the card). It takes you straight to the documentation page for that table's area, so you can read what the tables contain before you enable them.

How to enable cleanup for a table

  1. Open the Data Cleanup Setup list (search for Data Cleanup Setup, or open it from Data Administration).
  2. The first time, choose Update / Initialize. This fills the list with every table that can be cleaned up. Run it again after an update to pick up newly added tables.
  3. Filter on the Application Area column to focus on one module, and read the area documentation to understand what each table contains.
  4. Select a table and open the card. Check or set:
    • Enabled — turn cleanup on for this table.
    • Period Code — how long records are kept (see Retention periods below).
    • Date Field — which date/time field decides a record's age.
  5. To automate deletion, schedule the cleanup with a job queue entry (see Running and automating cleanup).
Tip

Several tables are enabled by default because they are safe, high-volume logs (for example scan sessions and sent e-mails). Everything else is off by default — you decide what to switch on. Each area page marks which tables are on by default.

Retention periods

A retention period describes how old a record must be before it may be deleted. Periods are reusable and maintained on the Data Cleanup Period page. A period is simply a unit (Day, Week, Month, Year) times a count:

Period Unit Period Count Meaning Records older than
Month 1 1 Month 1 month are deleted
Month 3 3 Months 3 months are deleted
Year 2 2 Years 2 years are deleted
Year 7 7 Years 7 years are deleted

Behind the scenes this becomes a date formula (for example <-3M> for three months) that is measured against the record's Date Field.

  • Period Code — the normal setting: everything older than this period is removed.
  • Start Period Code (optional) — set this as well to clean only a window in the past (older than Period Code but newer than Start Period Code). Leave it empty to clean everything older than Period Code.

One rule or several: Apply to All Records

  • Apply to All Records = Yes — one rule applies to the whole table. Use the Period Code and Date Field on the card.
  • Apply to All Records = No — the table is cleaned with several lines, each with its own period, date field and Table Filter. Use this when different parts of a table should be kept for different lengths of time — for example warehouse documents that are kept 3 years, except Customer Transfer documents which are kept only 3 months.

Each line has a Table Filter so you can limit exactly which records it applies to (for example a specific document type or message code).

Truncate

Truncate deletes all matching records in one fast operation instead of row by row. It is much faster on large tables, but it skips the table's OnDelete logic. 3PL Dynamics only allows Truncate for tables where that is safe; for tables that must run their delete logic the option is unavailable and a normal delete is used automatically.

Running and automating cleanup

From the Data Cleanup Setup card you can run and preview cleanup for the selected table:

  • Count Records — reports how many records currently match the rule without deleting anything. Always use this first to check your settings.
  • Cleanup — deletes the matching records for this table (you are asked to confirm).

The Statistics section shows Records within Filter, Last Counted, Total Records Deleted, and Last Executed so you can see the effect of each run.

To keep your database clean automatically, schedule the cleanup to run outside business hours (for example on Saturday nights) with a Job Queue Entry. See Job Queue for how to create and schedule job queue entries.

Tip
  • The first run takes longer than later runs.
  • Always run Count Records before enabling automatic cleanup, so you know exactly what will be deleted.

What the row colours mean

In the Data Cleanup Setup list some rows are coloured. This is automatic — it reflects the health of the underlying table and is not something you configure. It simply helps an administrator spot setups that point at tables which are going away:

Colour Meaning What to do
Normal (no colour) The table exists and is healthy. Nothing — configure cleanup as usual.
Amber / attention The table is marked obsolete – pending: it still works today but will be removed in a future version. You can still clean it; be aware it will disappear later.
Red The table has been removed or can no longer be found. The setup no longer does anything. It is cleaned up automatically, but you can ignore it.
Note

When you open the list, setups for tables that no longer exist are removed automatically, so red rows should be rare.