MES Artifact Selector

Sepasoft MES Module Suite

MES Artifact Selector | Vision

A component to allow selection of MES Artifact objects. It contains a Name Filter property to filter the MES Artifact objects to include in the list.

This component would generally have its Selected MES Object property bound to the Selected MES Object property of an MES Object Selector (sample binding below).

Python
Root Container.MES Object Selector.selectedMESObject

Component Properties

Properties are provided that can be set to affect the operation and look of the component. They can be set through the Property Editor in the Designer or through scripting.

Example

Python
event.source.parent.getComponent('MES Artifact Selector').visible = True



Data

Name Scripting Property Type Description
Name Filter nameFilter String Filter value, including * and ? wildcard characters, to filter results by names.
Selected MES Object selectedMESObject MESObjectLink The selected MES Object Link.
Data Quality dataQuality Integer The data quality code for any tag bindings on this component.

Event Handlers

Event handlers provide the ability to add custom script when a user interacts with a component such as by clicking a mouse, selecting a menu item or when a component property changes.

mouse

mouseClicked

This event signifies a mouse click on the source component. A mouse click the combination of a mouse press and a mouse release, both of which must have occurred over the source component. Note that this event fires after the pressed and released events have fired.

Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

mouseEntered

This event fires when the mouse enters the space over the source component.

Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

mouseExited

This event fires when the mouse leaves the space over the source component.

Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

mousePressed

This event fires when a mouse button is pressed down on the source component.

Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

mouseReleased

This event fires when a mouse button is released, if that mouse button's press happened over this component.

Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

mouseMotion

mouseDragged

Fires when the mouse moves over a component after a button has been pushed.


Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

mouseMoved

Fires when the mouse moves over a component, but no buttons are pushed.

Property Description
.source The component that fired this event.
.button The code for the button that caused this event to fire.
.clickCount The number of mouse clicks associated with this event.
.x The x-coordinate (with respect to the source component) of this mouse event.
.y The y-coordinate (with respect to the source component) of this mouse event.
.popupTrigger Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists.
.altDown True (1) if the Alt key was held down during this event, false (0) otherwise.
.controlDown True (1) if the Ctrl key was held down during this event, false (0) otherwise.
.shiftDown True (1) if the Shift key was held down during this event, false (0) otherwise.

propertyChange

propertyChange

Fires whenever a bindable property of the source component changes. This works for standard and custom (dynamic) properties.

Property Description
.source The component that fired this event.
.newValue The new value that this property changed to.
.oldValue The value that this property was before it changed. Note that not all components include an accurate oldValue in their events.
.propertyName The name of the property that changed. NOTE: Remember to always filter out these events for the property that you are looking for! Components often have many properties that change.


Extension Functions

artifactSelected

  • Description

Called when an MES Artifact name is selected.

  • Parameters

self - A reference to the component that is invoking this function.

mesArtifactName - The MES Artifact Name.

  • Return

1

  • Scope

Client


Custom Methods

Custom methods allow you to add your own component functions to a component that can be called through scripting. This is a useful and clean method of re-using script that is specific to the component (say you want to update a visual aspect of the component in the same way whether a user clicks on the component or a window property value changes). See Component Custom Methods in the Ignition Help Manual for more information.


Customizers

This component does not have any custom properties.


Component Functions

This component provides the following function that can be called on it. If this component has been dropped onto the windows root container, the path and an example call would be event.source.parent.getComponent('MES Artifact Selector').refresh().

refresh()

  • Description

Updates contents to reflect any updates to the database since the object was created, or since the last refresh. By default, refresh is automatic for local operations when view navigation touches an update.

  • Parameters

None

  • Return

Nothing

  • Scope

Client

Artifact Object Functions

MES objects inherit these functions. Use these functions to add artifacts to objects.

Artifact Names

Success Artifact names are always set to lowercase to be case insensitive, when you call any of the artifact methods for get/set/create artifact the name is lowercased first.

 createArtifact(artifactName, serializableValue)

Description

Create a new MES Artifact property named by artifactName on an existing MES Object, with a provided primitive, Pythonic or Java serializable object as the serializableValue (including strings, integer/real/float/double numbers and Boolean). The new MES Artifact is 'versioned' so each save creates a new version of the artifact (one additional row in the DB per version saved).

Files are also 'serializable' (Artifacts serialize the file as an array of bytes. Add "from java.io import File" to script and use File (fileName) where fileName contains the path to the file, with filename and extension. Refer to the Java Class File page).

Syntax

createArtifact(artifactName, serializableValue)


  • Parameters

String artifactName - the name of the 'versioned' MES Artifact to create. Name will be stored using lower-case letters.

Serializable serializableValue - Any primitive, Pythonic or Java serializable object (including strings, integer/real/float/double numbers and Boolean). Files are also 'serializable'.

  • Returns

MESArtifactProperty - A reference to the newly-created Artifact property.

  • Scope

All

Python
# Create a new 'versioned' MES Artifact object called 'my artifact'
#    on the Material Definition 'Test Material' and set the value
#    of the new Artifact to the string "Hello World".
obj = system.mes.loadMESObject('Test Material', 'MaterialDef')
obj.createArtifact('my artifact', 'Hello World')
system.mes.saveMESObject(obj)

createArtifact(artifactName, serializableValue, versioned)

Description

Create a new MES Artifact property named by artifactName on an existing MES Object, with a provided primitive, Pythonic or Java serializable object as the serializableValue (including strings, integer/real/float/double numbers and Boolean). 

Files are also 'serializable' (Artifacts serialize the file as an array of bytes. Add "from java.io import File" to script and use File (fileName) where fileName contains the path to the file, with filename and extension. Refer to the Java Class File page).

If versioned=FALSE, only one artifact with the version 0 is created and each save overwrites the previous value. If versioned=TRUE, then the artifact is saved with its timestamp, such that each save creates a new version of the artifact (one additional row in the DB per version saved).

Syntax

createArtifact(artifactName, serializableValue, versioned)


  • Parameters

String artifactName - the name of the Artifact to create. Name will be stored using lower-case letters.

Serializable serializableValue - Any primitive, Pythonic or Java serializable object (including strings, integer/real/float/double numbers and Boolean. Files are also 'serializable'.

Boolean versioned - FALSE means only one artifact is stored and is overwritten on each save. TRUE keeps a versioned copy with timestamp as an additional row in the database on each save.

  • Returns

MESArtifactProperty - A reference to the newly-created Artifact property.

  • Scope

All

Python
# Create a new 'unversioned' MES Artifact object called 'unversioned artifact'
#    on the Material Definition 'Test Material' and set the value
#    of the new Artifact to the string "Hello World".
obj = system.mes.loadMESObject('Test Material', 'MaterialDef')
obj.createArtifact('unversioned artifact', 'Hello World', False)
system.mes.saveMESObject(obj)

getArtifactCount()

Description

Returns the number of artifacts that exist for this MES Object.

Syntax

getArtifactCount()


  • Parameters

None

  • Returns

Integer - The number of artifacts that exist for this MES Object.

  • Scope

All


getAllArtifactNames()

Description

Returns a list with the Name property for all artifacts that exist for this MES Object, as well as for all parent objects.

Syntax

getAllArtifactNames()


  • Parameters

None

  • Returns

List - A Pythonic list with the Name property for all artifacts that exist for this MES Object, as well as for all parent objects. Names have all been previously created with lower-case letters.

  • Scope

All

 getArtifactNames()

Description

Returns a list with the Name property for all artifacts that exist for this MES Object.

Syntax

getArtifactNames()


  • Parameters

None

  • Returns

List - A Pythonic list with the Name property for all artifacts that exist for this MES Object. Names have all been previously created with lower-case letters.

  • Scope

All

 getArtifactProperty(artifactName)

Description

Returns the MES Artifact Property of the specified Artifact on the MES Object.

Syntax

getArtifactProperty(artifactName)


  • Parameters

String artifactName - The Name of the Artifact on the MES Object. Names have all been previously created with lower-case letters.

  • Returns

MESArtifactProperty - The MES Artifact Property of the specified Artifact on the MES Object.

  • Scope

All

getArtifactProperties()

Description

Returns all of the MES Artifact Properties of the specified Artifact on the MES Object.

Syntax

getArtifactProperties()


  • Parameters

None

  • Returns

MESPropertyCollection - All of the MES Artifact Properties of the specified Artifact on the MES Object.

  • Scope

All

 getArtifactValueByName(artifactName)

Description

Returns the value of the Artifact on the MES Object specified by the Artifact's Name.

Syntax

getArtifactValueByName(artifactName)


  • Parameters

String artifactName - The Name of the Artifact on the MES Object. Names have all been previously created with lower-case letters.

  • Returns

Serializable - The primitive, Pythonic or Java serializable object value stored for the Artifact on the MES ObjectFiles are also 'serializable', so file contents are returned as an array of bytes.

  • Scope

All

Python
obj = system.mes.loadMESObject('Widget A', 'MaterialDef')
ds = obj.getArtifactValueByName('test data')
print ds ##prints data set.

getArtifactValueByUUID(artifactUUID)

Description

Returns the value of the Artifact on the MES Object specified by the Artifact's UUID.

Syntax

getArtifactValueByUUID(artifactName)


  • Parameters

String artifactUUID - The UUID of the Artifact on the MES Object.

  • Returns

Serializable - The primitive, Pythonic or Java serializable object value stored for the Artifact on the MES ObjectFiles are also 'serializable', so file contents are returned as an array of bytes.

  • Scope

All

setArtifactValue(artifactName, serializableValue)

Description

Updates an existing MES Artifact property named by artifactName on an existing MES Object, with a provided primitive, Pythonic or Java serializable object as the serializableValue (including strings, integer/real/float/double numbers and Boolean). 

Files are also 'serializable' (Artifacts serialize the file as an array of bytes. Add "from java.io import File" to script and use File (fileName) where fileName contains the path to the file, with filename and extension. Refer to the Java Class File page).

Syntax

setArtifactValue(artifactName, serializableValue)


  • Parameters

String artifactName - the name of the Artifact to update. Names have all been previously created with lower-case letters.

Serializable serializableValue - Any primitive, Pythonic or Java serializable object (including strings, integer/real/float/double numbers and Boolean)Files are also 'serializable'.

  • Returns

Nothing

  • Scope

All

Sepasoft MES Module Suite