Archive Schedules
An archive schedule marks questionnaire results and registrations as archived, automatically and on a recurring schedule. Archived data stays safely on the server — but the next time the mobile app synchronises, archived results and registrations are removed from the device.
That removal is the point of archiving. When data is collected over a long period, every result and every attached photo and file accumulates in the mobile app's database. Devices slow down, storage fills up, and synchronisation takes longer. Archiving the records that are no longer needed in the field keeps the devices light while the full data set remains intact on the server.
A schedule decides what is archived — questionnaire results only, or whole registrations together with all their results — and which rows qualify, through a condition on a question, such as an answer value or a date. Each run archives only the rows that match and have not been archived already.
Archive schedules are useful when:
- Data is collected over months or years and the devices accumulate results and attached photos that field staff no longer need.
- Results past a certain age should leave the devices automatically — for example everything older than a year.
- Completed registrations and all the results collected on them should disappear from the app once a season or campaign ends.
- Storage on the devices must stay bounded without anyone cleaning devices by hand.
What archiving does
Archiving sets an archive flag on the matching rows. It does not delete anything on the server — archived rows remain in the database and can be unarchived if needed. What changes is on the device: the flag travels with the next synchronisation, and the mobile app removes the archived results and registrations, together with the photos and files stored for them in the app's database.
- Important: archiving removes data from devices. Only archive records that have been synchronised to the server — data that only exists on a device would be removed with it.
- Archive only, never unarchive. The schedule never reverses the flag. A row that is manually unarchived and still matches the condition is simply archived again on the next run.
- Already archived and deleted rows are skipped, so re-running the schedule is safe and only picks up newly matching rows.
- A run archives up to 1,000 rows. When more rows match, the rest are archived on the following runs until the backlog is cleared.
How an archive schedule works
An archive schedule is defined by the following settings:
| Setting | Purpose |
|---|---|
| Name | A label for the schedule, shown in the list. |
| Report type | Set to Archive. |
| Archive scope | Survey results only archives matching results in the selected questionnaires and leaves registrations untouched. Registrations and all their results archives matching registrations and cascades to every result collected on them. |
| Questionnaires or Registration | With the results scope, a checklist of the questionnaires whose results are archived. With the registrations scope, the registration whose rows are archived. |
| Archive when question, Condition, Value | The filter every row must match to be archived — a question on the result or the registration, an operator, and a value. A value starting with = is evaluated as a formula at run time, which is how date-based archiving works. |
| Frequency | Daily, weekly or monthly. |
| Send time and timezone | The time of day the archive runs, and the timezone that time refers to. |
| Active | Whether the schedule runs at all. An inactive schedule is kept but does not archive. |
An archive schedule sends nothing by email — there are no recipients, subject or email template, and those fields are not shown.
The list of schedules
The Scheduled Reports page shows one row per schedule. Each row summarises the schedule without opening it:
- Name. The label the user chose for this schedule.
- Report. For archive schedules this shows the scope and target.
- Schedule. How often the archive runs. For weekly schedules it includes the weekday; for monthly schedules the day of the month.
- Time. The time of day and time zone the archive runs.
- Next run. The date the schedule is next due.
- Last run. The date the schedule last ran.
- Active. A checkbox that shows whether the schedule is currently running. The user can clear it to pause the schedule without deleting it.
- Actions. A pencil to edit the schedule, and a bin to delete it.
Adding a schedule
Pressing the Add schedule button at the top of the page opens a dialog. The same dialog is used to edit an existing schedule, pre-filled with its current settings.
1. Name
A label for the schedule, used in the list. Choose something that describes what is archived, such as Archive results older than a year or Archive completed registrations.
2. Report type and Archive scope
Choose Archive as the report type. Next to it, choose the scope:
- Survey results only. Archives the matching questionnaire results. The registrations they were collected on stay on the devices — the right choice when field staff still need the customer or site records but no longer need the finished results and their photos.
- Registrations and all their results. Archives the matching registrations and every questionnaire result collected on them, including results linked through actions. The right choice when a subject is finished entirely — for example a completed customer or an ended campaign — and everything about it should leave the devices.
3. Questionnaires or Registration
With the Survey results only scope, a checklist of questionnaires appears — tick every questionnaire whose results should be archived. With the Registrations and all their results scope, pick the registration whose rows should be archived.
4. Archive when question, Condition and Value
The filter every row must match to be archived. Choose a question (on the result for the results scope, on the registration for the registrations scope), an operator (=, !=, contains, <, <=, >, >=) and a value — for example a status question = completed.
For date-based archiving, enter a formula starting with = as the value: it is evaluated at run time. Comparing a date answer with <= =today - 365 archives everything older than a year; the formula is recalculated on every run, so the threshold moves with the calendar instead of freezing at the day the schedule was created.
5. Frequency
How often the archive runs: daily, weekly or monthly. Archiving is not urgent — a weekly run is usually enough to keep devices light.
6. Send time and timezone
The time of day the archive runs, and the timezone that time refers to. Pick a time outside working hours, so the archived rows are gone from the devices after the next morning's synchronisation.
7. Active
A checkbox at the bottom of the dialog. When ticked, the schedule is live and archives on its next due date. When unticked, the schedule is kept in the list but does not run.
Saving, testing and running
At the bottom of the dialog, the user has four buttons.
Cancel
Close the dialog without saving. Any changes are discarded.
Test
Count the registrations and questionnaire results that would be archived — nothing is changed. When the value is a formula, the resolved value is shown too, so the threshold can be checked. Always run a test first: it is the safety check that the condition matches the rows intended before anything is removed from devices.
Run
Execute the archive immediately instead of waiting for the next due date — up to 1,000 matching rows per manual run. The outcome shows how many registrations and results were archived, and whether more matching rows remain for the next run.
Save
Save the schedule. Save is disabled until a condition question and value are set, and until the scope's selection is made — at least one questionnaire for the results scope, a registration for the registrations scope. If the server rejects any value, the dialog shows the field-level error and does not close.
Editing, pausing and deleting a schedule
From the list, the user can:
- Pause a schedule by clearing the Active checkbox in the row. The schedule stays in the list; it just will not run on its next due date. Ticking it again resumes the schedule.
- Edit an existing schedule with the pencil icon. The dialog opens with all the settings pre-filled from that schedule.
- Delete a schedule with the bin icon. A confirmation prompt appears first. Deleting a schedule does not unarchive anything — rows already archived stay archived.
Basic examples
Example 1: weekly archive of results older than a year
Field staff have collected visit reports for years, each with attached photos. The devices are filling up, but staff still need the registrations and recent results. Anything older than a year can leave the devices.
- On the Scheduled Reports page, click Add schedule.
- Name: Archive results older than a year.
- Report type: Archive. Archive scope: Survey results only — the registrations stay on the devices.
- Questionnaires: tick the visit report questionnaire.
- Archive when question: visitDate, Condition:
<=, Value:=today - 365. The formula moves with the calendar, so next week the threshold is a week later too. - Frequency: Weekly, on the weekend.
- Send time: 02:00. Timezone: the organisation's local timezone.
- Active: ticked.
- Save.
- Reopen the schedule and press Test. Check the resolved threshold date and the number of results that would be archived. If it looks right, press Run to archive the first batch.
Every week the schedule archives the newly aged-out results in batches of 1,000 until the backlog is cleared. After the next synchronisation, those results — and the photos stored with them — are gone from the devices, while the full history remains on the server.
Example 2: archiving completed registrations
A registration records each customer visited during a campaign. When a customer's campaign is finished, a status field on the registration is set to completed, and the customer together with every result collected on it should leave the devices.
- Create an archive schedule named Archive completed registrations.
- Report type: Archive. Archive scope: Registrations and all their results.
- Registration: the customer registration.
- Archive when question: status, Condition:
=, Value:completed. - Frequency: Daily, outside working hours. Active: ticked. Save.
- Press Test to see how many registrations and results match before archiving.
Each night the schedule archives every registration marked completed and cascades to all its questionnaire results. Field staff see the completed customers and their history disappear from the app after synchronising, while new and active registrations stay available.