Skip to main content
Version: V2 (Ignition 8.1)

system.mes.shift.exportAsCsv

Description

Exports all or selected shifts as raw bytes in CSV format (UTF-8 encoded). Streams shift data from the database and formats it as CSV, including a header row whose columns correspond to fields in ShiftImportDTO. When locationIdsOrPaths is omitted, all shifts are exported.

Permissions

This method requires the SHIFT.READ.GET permission.

Syntax

system.mes.shift.exportAsCsv()
system.mes.shift.exportAsCsv(locationIdsOrPaths=["Enterprise/Site/Line1"])

Parameters

ParameterTypeNullableDescription
locationIdsOrPathsString[]YesThe location ids or paths to filter shifts by. Omit to export all shifts.

Returns

A byte array (byte[]) containing the raw byte data of the CSV export (UTF-8 encoded).

Code Examples

Perspective

csvBytes = system.mes.shift.exportAsCsv()
system.perspective.download("shifts.csv", csvBytes)

Script Console

csvBytes = system.mes.shift.exportAsCsv()
path = system.file.saveFile("shifts.csv")
if path is not None:
system.file.writeFile(path, csvBytes)