Hi guys,
Still new to some of this. I'm having issues when using a for loop to drive the creation of instances for a template.
The code is creating the correct amount of instances and in the side panel under the instances section, I see all of the data I'm needing to supply my template with, but it's erroring and maybe it's just me being a noob, not sure.
The code is below
base_URL = system.tag.readBlocking('[default]RestfulEndpointBaseURL')[0].value
endpoint_URL = base_URL + self.parent.getChild("HeaderContainer").getChild("MachineName").props.text
result = system.net.httpClient().get(endpoint_URL)
isCurrentHour = ''
if result.statusCode == 200:
print result.json
views = []
for metric in result.json["content"]["metrics"]:
for obj in metric["HourlyKPI"]:
views.append({
"currentHour":isCurrentHour,
"DT":obj["kpi"]["downtime"],
"Hour":obj["hour"],
"OEE":obj["kpi"]["oee"],
"PT":obj["kpi"]["plannedDt"],
"RT":obj["kpi"]["runTime"],
"RU":obj["kpi"]["rejects"],
"UL":obj["kpi"]["u.lost"],
"UP":obj["kpi"]["u.prod"],
"UT":obj["kpi"]["u.theorical"]})
return views