I’m new to reporting and I’m trying to create a table that has sub tables (table group). The general format desired is something like:
Cut area:
Cut Machine 1 output details blah blah blah
Cut Machine 2 output details blah blah blah
Total of cut machines output machine output blah blah blah
Print area:
Print Machine 1 output details blah blah blah
Print Machine 2 output details blah blah blah
Total of print machines output blah blah blah
Etc.
So, I think what I need to do is create a dataset with sub datasets to feed the report, but the sub datasets aren’t working. I’m sure I’m missing something obvious in the second to the last line.
areaQuery = "ProductionModel/GetAreasDashboard"
lineQuery = "ProductionModel/GetLinesByArea"
parameters = {"AnalysisName":"Analysis"}
# Get a list of the areas in this plant
areas = system.db.runNamedQuery(areaQuery, parameters)
areaCount = areas.getRowCount()
areaData = dict()
lineData = []
for areaIndex in range(areaCount):
logger.info("Area %s" % areas.getValueAt(areaIndex, 'EquipmentName'))
areaName = areas.getValueAt(areaIndex, 'EquipmentName')
parameters = {"AnalysisName":"Analysis","Area":areas.getValueAt(areaIndex, EquipmentName')}
# Get a list of the lines for the selected area
lines = system.db.runNamedQuery(lineQuery, parameters)
linesCount = lines.getRowCount()
headers = ["Area", "Line", "LineData"]
for lineRow in range(linesCount):
linePath = lines.getValueAt(lineRow, 'EquipmentPath')
lineName = lines.getValueAt(lineRow, 'EquipmentName')
params = {"EquipmentPath":linePath}
# given line and area, get OEE and production for the specified period
lineResults = system.mes.analysis.executeAnalysis(data['StartDate'], data['EndDate'], "Production Report", params)
lineDS = lineResults.getDataset()
lineData.append([areaName, lineName, lineDS])
data['dailyDataByArea'] = system.dataset.toDataSet(headers, lineData);
The data fed to the report ends up looking like:
<dailyDataByArea>
<row-0>
<Area>Sheet Area</Area>
<Line>7101</Line>
<LineData>Dataset [24R x 20C]</LineData>
</row-0>
<row-1>
<Area>Sheet Area</Area>
<Line>7102</Line>
<LineData>Dataset [24R x 20C]</LineData>
</row-1>
<row-7>
<Area>Cut Area</Area>
<Line>7301</Line>
<LineData>Dataset [24R x 20C]</LineData>
</row-7>
<row-8>
<Area>Cut Area</Area>
<Line>7302</Line>
<LineData>Dataset [24R x 20C]</LineData>
</row-8>
Etc.
Any help greatly appreciated.
Craig L.