system.mes.analysis.registerCustomValueSource
Sepasoft MES Module Suite
Description
Register a custom value-source object to the MES Analysis Engine. This is an advanced feature not recommended for most users. Most use-cases can be accommodated without custom analysis features.
Syntax
system.mes.analysis.registerCustomValueSource(valueSource)
CustomValueSource valueSource - The custom value-source object of a class that extends the CustomValueSource class.
Nothing
Gateway
Code Examples
Code Snippet
|
from java.lang import Exception
from org.apache.log4j import Logger
log = Logger.getLogger("CustomAnalysis")
# It creates and registers a custom value-source object.
class CustomValueSource(system.mes.analysis.createCustomValueSource().__class__):
def __init__(self, dataConnectionName):
import system.mes.analysis
system.mes.analysis.createCustomValueSource().__class__.__init__(self, dataConnectionName)
self.setData("interval", 1)
def getGroupName(self):
return "Custom"
def getName(self):
return "Custom Value Source"
def getDescription(self):
return "Custom value source"
def getDataType(self):
from java.lang import Integer
return Integer
def isDataColumn(self):
return True
def isFilter(self):
return True
def isGroupBy(self):
return True
def isOrderBy(self):
return True
def isEquipmentInfoRequired(self):
return False
def setGroupValue(self, finalValueItem, finalRow, finalResults, isNewFinalRow, isFinalRow, lastValuesMode, equipmentValueItem, equipmentRow):
return self.defaultSetGroupIntegerValue(finalValueItem, finalRow, finalResults, isNewFinalRow, isFinalRow, lastValuesMode, equipmentValueItem, equipmentRow, self.getName())
def getRequiresGrouping(self):
return True
def getValueMode(self):
import system.mes.analysis
return system.mes.analysis.getValueModeType("LAST_VALUE")
def getDefaultValue(self):
return 0
def isCacheEnabeled(self):
return False
try:
log.info("Register a custom value-source object.")
system.mes.analysis.registerCustomValueSource(CustomValueSource("Custom Data Source"))
except Exception, e:
log.warn(e.getMessage())
|
Sepasoft MES Module Suite