Skip to main content

system.mes.equipment.importPropertiesFromCsv

Description

Imports Equipment Properties records from a CSV file provided as a string or as raw bytes.

Recommended to export at least one pre-existing equipment property to CSV using the exportPropertiesAsCsv functionality to ensure the correct format.

Permissions

This method requires the EQUIPMENT.WRITE.SAVE permission.

Syntax

system.mes.equipment.importPropertiesFromCsv(importString)
system.mes.equipment.importPropertiesFromCsv(importBytes)

Parameters

ParameterTypeNullableDescription
importStringStringFalseThe CSV content as a string.
importBytesPyArrayFalseThe CSV content as raw bytes.

Returns

Returns an ApiResponse containing import result details.

NameTypeDescription
successBooleanIndicates if the import was successful.
messageStringA summary of the import result.
dataStringDetails about the imported records.
errorStringAny errors encountered during import.

Code Examples

Bytes

def runAction(self, event):
csvBytes = event.file.getBytes()
system.mes.equipment.importPropertiesFromCsv(csvBytes)

String

def runAction(self, event):
csvString = event.file.getString()
system.mes.equipment.importPropertiesFromCsv(csvString)