Skip to main content
Version: V2 (Ignition 8.1)

system.mes.productionOrder.exportAsCsv

Description

Exports all or selected production orders as raw bytes in CSV format (UTF-8 encoded). Streams production order data from the database and formats it as CSV, including a header row. When idsOrNames is omitted, all production orders are exported.

Permissions

This method requires the PRODUCTION_ORDER.READ.GET permission.

Syntax

system.mes.productionOrder.exportAsCsv()
system.mes.productionOrder.exportAsCsv(idsOrNames=["PO-1001"])

Parameters

ParameterTypeNullableDescription
idsOrNamesString[]YesThe ids or names of the production orders to export. Omit to export all.

Returns

A byte array (byte[]) containing the raw byte data of the CSV export.

Code Examples

Perspective

csvBytes = system.mes.productionOrder.exportAsCsv()
system.perspective.download("production-orders.csv", csvBytes)

Script Console

csvBytes = system.mes.productionOrder.exportAsCsv()
path = system.file.saveFile("production-orders.csv")
if path is not None:
system.file.writeFile(path, csvBytes)