Sepasoft MES Module Suite
system.mes.analysis.createMESAnalysisSettings(savedSettingsName)
Create a new analysis setting object.
Syntax
system.mes.analysis.createMESAnalysisSettings(savedSettingsName)
- Parameters
String savedSettingsName - The name to the new analysis settings.
- Returns
MESAnalysisSettings - A new MESAnalysisSettings object used to store data points, filter expressions, group by, order by, etc.
- Scope
All
Python |
##Note that the Analysis Settings objects should be uniquely named. ##Therefore, it's best practice to check first before attempting to create a new one. sasName = 'SAS Test' list = system.mes.analysis.getMESAnalysisSettingsList() if sasName not in list: sasObj = system.mes.spc.analysis.createMESAnalysisSettings(sasName) print sasObj system.mes.saveMESObject(sasObj) else: print 'Analysis name already in use! Pick unique name.' |
Output
Code |
AnalysisSettings (6bd5b603-ab27-4a13-a01d-f8b581de4409, SAS Test, 0 parents, 0 children, 0 custom properties, 2 complex properties) |
Code Snippet
Python |
analysis_setting = system.mes.analysis.createMESAnalysisSettings("test_setting") datapoints = [ "Elapsed Time", "OEE Availability", "Runtime", "Planned Downtime", "Infeed Standard Count", "OEE Performance", "OEE Infeed Count", "OEE Quality", "OEE Reject Count", "OEE Outfeed Count", "Equipment Operation Sequence" ] analysis_setting.setDataPoints(datapoints) analysis_setting.addParameter('path') analysis_setting.setFilterExpression("Equipment Path = @path AND Operation UUID != ''") analysis_setting.setGroupBy("Equipment Operation Sequence") start_date = system.date.addYears(system.date.now(), -1) end_date = system.date.now() params = {'path':'[global]\Enterprise\Site\Area\Line 3'} print system.mes.analysis.executeAnalysis(start_date, end_date, analysis_setting, params).getDataset() |
Output
Code |
Dataset [186R x 11C] |
Syntax
system.mes.analysis.createMESAnalysisSettings(savedSettingsName, user)
- Parameters
String savedSettingsName - The name to the new analysis settings.
PyUser user - User object obtained by calling system.user.getUser(). This is optional and only available if calling this script from a Gateway Context, such as when doing analysis in a tag change event script or similar. If a user is passed in, their security settings will be used. If a user is not passed in and the script is executing from a Gateway Event script, analysis security settings will not be applied.
- Returns
MESAnalysisSettings - A new MESAnalysisSettings object used to store data points, filter expressions, group by, order by, etc.
- Scope
All
Python |
##Note that the Analysis Settings objects should be uniquely named. ##Therefore, it's best practice to check first before attempting to create a new one. sasName = 'SAS Test' list = system.mes.analysis.getMESAnalysisSettingsList() if sasName not in list: sasObj = system.mes.analysis.createMESAnalysisSettings(sasName) print sasObj user = system.user.getUser('UserSource', 'UserName') system.mes.saveMESObject(sasObj, user) else: print 'Analysis name already in use! Pick unique name.' |
Output
Code |
AnalysisSettings (6bd5b603-ab27-4a13-a01d-f8b581de4409, SAS Test, 0 parents, 0 children, 0 custom properties, 2 complex properties) |
Code Snippet
Code |
|
Output
Code |
Dataset [186R x 11C] |
Sepasoft MES Module Suite