Skip to main content
Version: V2 (Ignition 8.1)

system.mes.unitOfMeasure.exportAsCsv

Description​

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

Permissions​

This method requires the UNIT_OF_MEASURE.READ.GET permission.

Syntax​

system.mes.unitOfMeasure.exportAsCsv()
system.mes.unitOfMeasure.exportAsCsv(idsOrPaths=["Kilogram"])

Parameters​

ParameterTypeNullableDescription
idsOrPathsString[]YesThe ids or paths of the units of measure to export. Omit to export all.

Returns​

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

Code Examples​

Perspective​

csvBytes = system.mes.unitOfMeasure.exportAsCsv()
system.perspective.download("units-of-measure.csv", csvBytes)

Script Console​

csvBytes = system.mes.unitOfMeasure.exportAsCsv()
path = system.file.saveFile("units-of-measure.csv")
if path is not None:
system.file.writeFile(path, csvBytes)