Skip to end of metadata
Go to start of metadata
Description

Convert the specified MES objects to XML. The XML can then be written to a disk file, sent to external systems, written to a database, etc. by using other Ignition script functions.

Syntax

system.mes.exportMESObjects(filter)


  • Parameters

MESObjectFilter filter - A MESObjectFilter object specifying the MES object to include.

  • Returns

A XML string value representing all MES objects specified by the filter.

  • Scope

All

Code Examples
Code Snippet
#This code will print the XML string value.
filter = system.mes.object.filter.createFilter()
filter.setEnableStateName('ENABLED')
filter.setMESObjectTypeName('EquipmentClass')
xml = system.mes.exportMESObjects(filter)
print xml
 
#This code will write XML string value to a file.
filepath = system.file.openFile("xml")
if filepath != None:
		system.file.writeFile(filepath, xml)
Output
<?xml version="1.0"?>
<MESObjectList>
	<MESObject MESObjectType="EquipmentClass">
		<CoreProperty name="UUID">a0a7991c-ee75-47d7-8c91-b0e20e736ea9</CoreProperty>
		<CoreProperty name="Name">Storage Tank</CoreProperty>
		<CoreProperty name="Description">receiving water</CoreProperty>
		<ChildReference>
			<MESObjectType>StorageUnit</MESObjectType>
			<MESObjectUUID>8da06ff8-2922-4e0c-a01a-e7cda6899a0e</MESObjectUUID>
		</ChildReference>
		<ChildReference>
			<MESObjectType>StorageUnit</MESObjectType>
			<MESObjectUUID>d9eb9a1a-4503-436a-9765-d57ae8af0ec1</MESObjectUUID>
		</ChildReference>
	</MESObject>
	<MESObject MESObjectType="EquipmentClass">
		<CoreProperty name="UUID">dc161370-e4dd-496c-8d67-bc306db95843</CoreProperty>
		<CoreProperty name="Name">Substation 1</CoreProperty>
		<CoreProperty name="Description">This is a station to collect the turkeys</CoreProperty>
	</MESObject>
</MESObjectList>
  • No labels