---
title: "Shifts | Use Script to find and print shifts configured for an Equipment"
id: "script-to-find-and-print-shift-s-configured-for-an-equipment-3-0"
project: "Knowledge Base"
url: "https://docs.sepasoft.com/articles/knowledge-base/script-to-find-and-print-shift-s-configured-for-an-equipment-3-0"
updated: 2026-07-23T18:08:41Z
---

# Shifts \| Use Script to find and print shifts configured for an Equipment

### Find and Print Shifts for Equipment via Script

To use a script to find the Shift that has been configured for Equipment, follow the steps below:
![](/resources/Storage/knowledge-base/script-to-find-and-print-shift-s-configured-for-an-equipment-3-0/image2022-12-22_11-39-4.png)
## 

* Use this function/code

```python
eqObj= system.mes.loadMESObjectByEquipmentPath('<Enterprise>\<Site>\<Area>\<Line>')  
eqObj.getIgnitionSchedule()


```
![](/resources/Storage/knowledge-base/script-to-find-and-print-shift-s-configured-for-an-equipment-3-0/image2022-12-22_11-40-50.png)
* If you wanted to get all your Equipment shifts assignments, use this code:

Get Shifts For Equipment

```python
def visitChildren(root, list):
	validEquipment = ['Line','LineCell','LineCellGroup','Location']

 	for child in root.getChildCollection().values():
 		mesObject = child.getMESObject()
 		if mesObject.getMESObjectTypeName() in validEquipment:
 			print mesObject.getEquipmentPath(),mesObject.getIgnitionSchedule()
 		visitChildren(mesObject, list)
 	return
 
filter = system.mes.object.filter.createFilter()
filter.setMESObjectTypeName('Enterprise')
filter.setEnableStateName('Enabled')
root = system.mes.searchMESObjects(filter).get(0).getMESObject()

visitChildren(root, None)
```
![](/resources/Storage/knowledge-base/script-to-find-and-print-shift-s-configured-for-an-equipment-3-0/image2022-12-22_11-44-48.png)
* If you wanted for example to find the Shift Available for a given Date/Time Window for a given Equipment, another option would be:


```python
begin = system.date.now()
anotherBegin = system.date.addDays(begin, 4)
end = system.date.addDays(begin, 5)

print begin
print anotherBegin
print end
   
analysis = system.mes.analysis.createMESAnalysisSettings('analysis')
analysis.setDataPoints("Line Schedule Available,Scheduled Shift")
analysis.setFilterExpression("Equipment Path = 'Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1'")
analysis.setGroupBy("Scheduled Shift")
analysis.setSettingValues("Include Future=True")
 
# system.mes.analysis.executeAnalysis() returns an MES Analysis Results object
 
# For documentation, see: https://help.sepasoft.com/docs/display/MHD/MES+Analysis+Results
results = system.mes.analysis.executeAnalysis(anotherBegin, end, analysis)
 
if results.hasMessage():
    count = results.getMessageCount()
    message_list = [str(results.getMessage(index)) for index in range(count)]
 
# getDataset() returns an Ignition Dataset
# For documentation, see: https://docs.inductiveautomation.com/display/DOC79/Datasets
dataset = results.getDataset()
sep = ",\t"
print sep.join(dataset.getColumnNames())
for row in range(dataset.getRowCount()):
    print sep.join(map(str, dataset.getRow(row)))


```
