system.mes.location.exportAsCsv
Description
Exports all or selected Locations as a CSV string (UTF-8 encoded).
Streams location data from the database and formats it as a CSV string, including a header row.
When idsOrPaths is omitted, all locations are exported.
Permissions
This method requires the LOCATION.READ.GET permission.
Syntax
system.mes.location.exportAsCsv()
system.mes.location.exportAsCsv(idsOrPaths=["Enterprise/Site/Line1"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
idsOrPaths | String[] | Yes | The ids or paths of the locations to export. Omit to export all. |
Returns
All locations as a CSV string (UTF-8 encoded).
Code Examples
Perspective
csvString = system.mes.location.exportAsCsv()
system.perspective.download("locations.csv", csvBytes)
Script Console
csvString = system.mes.location.exportAsCsv()
path = system.file.saveFile("locations.csv")
if path is not None:
system.file.writeFile(path, csvString)