---
title: "Purge SPC Data 3.0"
id: "purge-spc-data-3-0"
project: "Knowledge Base"
url: "https://docs.sepasoft.com/articles/knowledge-base/purge-spc-data-3-0"
updated: 2026-07-23T18:08:39Z
---

# Purge SPC Data 3\.0

## Overview

Purging historical SPC data may be necessary when testing or if the data is no longer relevant.

### Applies To and Version Info

This feature applies to SPC module and is available in version 1.8.1 and above.

## Scripting


Code

```
sampleDefName = 'Nonconformity'
sampleDefObj = system.mes.spc.definition.getSampleDefinition(sampleDefName)
defUUID = sampleDefObj.getUUID()
priorToDate = system.date.addDays(system.date.now(),-15)
system.mes.spc.sample.purgeSampleData(defUUID, priorToDate)
```


The script above will remove only sample data.

If SPC is the only MES module used or if deleting all MES data **(including other modules)** is desired, you can set the data retention period on the gateway and the module will automatically trim all runtime data prior to the date provided.

![](/resources/Storage/knowledge-base/purge-spc-data-3-0/image2022-12-27_10-44-1.png)