system.mes.oee.exportOeeStatesToCsv
Description
Exports OEE State configs to CSV format. You can export all states or filter by specific locations using the optional locationIdOrPaths parameter.
Permissions
This method requires the OEE.READ.GET permission.
Syntax
# Export all OEE states
system.mes.oee.exportOeeStatesToCsv()
# Export states for specific locations (filtering)
system.mes.oee.exportOeeStatesToCsv(locationIdOrPaths)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
locationIdOrPaths | String[] | Yes | (Optional) Array of location IDs or paths to export. When omitted, all state configs are exported. |
Returns
Returns a byte array containing the CSV data of the exported OEE states. If locationIdOrPaths is provided, only states for those locations are included.
Code Examples
Perspective
# Export all OEE states
csvBytes = system.mes.oee.exportOeeStatesToCsv()
system.perspective.download("oee_states.csv", csvBytes)
# Export states for specific locations
locationPaths = ["Enterprise/Site/Area/Line1", "Enterprise/Site/Area/Line2"]
csvBytesFiltered = system.mes.oee.exportOeeStatesToCsv(locationPaths)
system.perspective.download("oee_states_filtered.csv", csvBytesFiltered)
Script Console
# Export all OEE states
csvBytes = system.mes.oee.exportOeeStatesToCsv()
path = system.file.saveFile("oee_states.csv")
if path is not None:
system.file.writeFile(path, csvBytes)
# Export states for specific locations
locationPaths = ["Enterprise/Site/Area/Line1", "Enterprise/Site/Area/Line2"]
csvBytesFiltered = system.mes.oee.exportOeeStatesToCsv(locationPaths)
pathFiltered = system.file.saveFile("oee_states_filtered.csv")
if pathFiltered is not None:
system.file.writeFile(pathFiltered, csvBytesFiltered)