system.mes.material.exportReasonCodesAsCsv
Description
Exports all or selected material reason codes as raw bytes in CSV format (UTF-8 encoded).
Streams material reason code data from the database and formats it as CSV, including a header row.
When idsOrCodes is omitted, all material reason codes are exported.
Permissions
This method requires the MATERIAL.READ.GET permission.
Syntax
system.mes.material.exportReasonCodesAsCsv()
system.mes.material.exportReasonCodesAsCsv(idsOrCodes=["SCRAP"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
idsOrCodes | String[] | Yes | The ids or codes of the material reason codes 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.material.exportReasonCodesAsCsv()
system.perspective.download("material-reason-codes.csv", csvBytes)
Script Console
csvBytes = system.mes.material.exportReasonCodesAsCsv()
path = system.file.saveFile("material-reason-codes.csv")
if path is not None:
system.file.writeFile(path, csvBytes)