---
title: "system.mes.getTagCollectorValue"
id: "system-mes-gettagcollectorvalue"
project: "MES User Manual"
url: "https://docs.sepasoft.com/articles/user-manual/system-mes-gettagcollectorvalue"
updated: 2026-07-31T14:59:21Z
---

# system\.mes\.getTagCollectorValue

**Sepasoft MES Module Suite**

### system.mes.getTagCollectorValue

Tag Collectors bring raw values into the system and record them off for use in calculations or triggering events. The getTagCollectorValue script functions are used to return a single value that has previously been recorded for the MES tag collector.

Some tag collectors have multiple possible values, and therefore have a 'key'. Consider the case of a product count from a machine. The counted product could be Infeed, Outfeed, or a Reject part. By asking for a tag collector value of "Equipment Count" collectorType, we still need to indicate the infeed/outfeed/reject that we seek.

See [Tag Collector Types](/articles/user-manual/tag-collector-types) for more details.

In some cases, the collectorType and key are insufficient to discern which value is requested. The most common example being Equipment State. Equipment State may be changed, for example, if a downtime reason is overridden by an operator. Therefore the original reason and the re-assigned reason could be returned. Thus Auxiliary Values are used to determine the relevant piece of data to return to the user calling the getTagCollectorValue function when collector type and key are insufficient to determine just one value.

Equipment State Tag Collector Auxiliary Values

| ![Information](/resources/Storage/user-manual/user-manual/Info.png) | <ul><li>EquipmentUUID - The unique identifier for the equipment.</li><li>State - The current equipment state.</li><li>OriginalState - The original equipment state before it was updated.</li><li>DifferedToUUID - If the original&#160;EquipmentUUID is changed using the Downtime Table then the new uuid is&#160;DifferedToUUID.</li><li>DifferedState -&#160;If the original&#160;state&#160;is changed using the Downtime Table then the new state is&#160;DifferedState.</li></ul> |
| --- | --- |

#### system.mes.getTagCollectorValue(equipmentPath, collectorType, key, dateTime)

Return a single value that has previously been recorded for the MES tag collector.

**Syntax**

**system.mes.getTagCollectorValue(equipmentPath, collectorType, key, dateTime)**

Parameters

String **equipmentPath** - The path from the production model to the desired equipment.

String **collectorType** - The name of the tag collector type.

String **key** - Where there are multiple instances of a tag collector type, this specifies which one to use. For example, there can be multiple MES counters for the "Equipment Count" tag collector type. If not needed, pass an empty string. In other words it is the name of the MES counter or the name of the Additional Factor.

Date **dateTime** - The date of the value to return. As of 3.81.10 SP8, additional Factors can now be set in the future. Use system.date.addHours:

![](/resources/Storage/user-manual/system-mes-gettagcollectorvalue/system-mes-gettagcollectorvalue-2025-01-22.png)

Returns

Object **value** - The single value recorded for the specified dateTime, or None if there is no entry for the specified date.

Scope

All

Code Examples
 
```python
date = system.date.getDate(2017, 2, 20)
dateTime = system.date.setTime(date, 15, 13, 31)

equipmentPath = '[global]\Enterprise\Site\Area\Line 1'
collectorType = 'Equipment State'
key = ''

tagValue = system.mes.getTagCollectorValue(equipmentPath, collectorType, 'OriginalState', key, dateTime)
print tagValue
```

Output

Code

```
 8
```


#### system.mes.getTagCollectorValue(equipmentPath, collectorType, auxValueName, key, dateTime)

Return a single value that has previously been recorded for the MES tag collector.

Syntax

**system.mes.getTagCollectorValue(equipmentPath, collectorType, auxValueName, key, dateTime)**

Parameters

String **equipmentPath** - The path from the production model to the desired equipment.

String **collectorType** - The name of the tag collector type. /articles/user-manual/tag-collector-types

String **auxValueName** - This specifies which auxiliary value to update. For example, the Equipment State tag collector has an "OriginalState" auxiliary value. See Auxiliary value listing at the top of the page for more information.

String **key** - Where there are multiple instances of a tag collector type, this specifies which one to use. For example, there can be multiple MES counters for the "Equipment Count" tag collector type. If not needed, pass an empty string. In other words it is the name of the MES counter or the name of the Additional Factor.

Date **dateTime** - The date of the value to return.

* Returns

Object **value** - The single value recorded for the specified dateTime, or None if there is no entry for the specified date.

* Scope

All

Code Example
 
```python
date = system.date.getDate(2017, 2, 20)
dateTime = system.date.setTime(date, 15, 13, 31)

equipmentPath = '[global]\Enterprise\Site\Area\Line 1'
collectorType = 'Equipment State'
key = ''

tagValue = system.mes.getTagCollectorValue(equipmentPath, collectorType, 'OriginalState', key, dateTime)
print tagValue
```

Output

Code

```
 8
```


**Sepasoft MES Module Suite**