liam1
1
I want to be able to selected from a list of previously run batches and view a selected batch in the EBR Viewer.
Only issue is, I need to provide the exact BatchID used.
We currently use ISA88 tag name combined with Unix timestamp to create a unique batch ID.
Is there a way of generating a list on batchID's where I can filter by date and a string name pattern
ie STU_01_02_02*
?
Yes, the easiest way is to create an analysis setting like so:
You could use the analysis controller or the analysis script library to populate the desired list.
liam1
4
Okay I figured out how to create the same analysis settings used in the analysis selector component through scripting.
Here is the current settings , which returns data.
Here is the same analysis settings implemented in scripting.
I'm getting this error message.
What is equivalent datapoint name for "Procedure/Batch_ID" ?
For a quick conversion of your analysis settings to script, the MES Monitor component has a built-in feature:
Find your Named Analysis you executed and right click in the Metric Details section:
Pasting the copied script in the chat will give you an idea of how to formulate your script:
end = system.date.now()
begin = system.date.addDays(end, -8)
analysis = system.mes.analysis.createMESAnalysisSettings('analysis')
analysis.setDataPoints("Procedure/Batch_ID,Procedure/Recipe_Name")
analysis.setFilterExpression("Equipment Path LIKE 'Enterprise\Site\Area\Process Cell*'")
analysis.setGroupBy("Procedure/Batch_ID,Procedure/Recipe_Name")
# system.mes.analysis.executeAnalysis() returns an MES Analysis Results object
# For documentation, see: https://help.sepasoft.com/docs/display/MHD/MES+Analysis+Results
results = system.mes.analysis.executeAnalysis(begin, end, analysis)
if results.hasMessage():
count = results.getMessageCount()
message_list = [str(results.getMessage(index)) for index in range(count)]
# getDataset() returns an Ignition Dataset
# For documentation, see: https://docs.inductiveautomation.com/display/DOC79/Datasets
dataset = results.getDataset()
sep = ",\t"
print sep.join(dataset.getColumnNames())
for row in range(dataset.getRowCount()):
print sep.join(map(str, dataset.getRow(row)))
liam1
6
Thank you ,based on your example I changed the values from a list of strings to a Parameter string.
It now works but I'm confused why my originals code didn't work when the documentation specifically specifies a List of strings as the parameter type.
liam1
7
This is a java list string not which is not the same as a python list string.