system.mes.spc.analysis.formatDate(date)

Sepasoft MES Module Suite

system.mes.spc.analysis.formatDate(date)

Returns a string for the specified date and is formatted correctly for a filter expression.

Warning

Scripting Function modifications in

MES 3.79.3 RC 5 and later
MES 3.81.4 RC 5 and later

Syntax

system.mes.spc.analysis.formatDate(date)

  • Parameters

Date date - A Date object to format.

  • Returns

String - A SPC settings formatted date string.

  • Scope

All

Code Example

Python
locationPath = 'Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'

startDate = system.mes.spc.analysis.formatDate(system.date.addHours(system.date.now(), -1))
endDate = system.mes.spc.analysis.formatDate(system.date.now())

definitionName = 'Case Inspection'
attribute = 'Fill Level'

controlLimits = 'CpPpUSL,CpPpLSL,PpTarget'
signals = ''
dataFormatName = 'Process Capability and Performance'
filters=''

spcsettings = system.mes.spc.analysis.createSettings(definitionName, attribute, filters, controlLimits, signals, dataFormatName)

filter = spcsettings.encodeList(['FromDate='+startDate,'ToDate='+endDate,'Location='+locationPath])
spcsettings.setFilters(filter)

results = system.mes.spc.analysis.getSPCResults(spcsettings)

ds = results.getTableResults()
print ds
print ds.getColumnNames()

for row in range(ds.getRowCount()):
	for col in range(ds.getColumnCount()):
		print ds.getColumnName(col),ds.getValueAt(row,col)



Sepasoft MES Module Suite