It takes about 30 seconds to gather the info in the query, then append in the 2 different sqltags for 100 different devices. I have this on a window event script>property change.
fieldID = event.source.getComponent('Dropdown').selectedValue
query = "SELECT d.devicename, d.displayname, f.name as 'Field Name', u.name as 'Unit Name', f.foreman FROM devices d right outer join fields f on d.fieldid = f.id right outer join units u on d.unitid = u.id where f.id = %s" % fieldID
if event.propertyName in ["currentDate", "refresh"]:
print query
table = event.source.getComponent('Table')
newData = []
header = ["Displayname", "Devicename", "Field", "Unit", "Foreman", "Comm Status", "Today's Throughput"]
res = system.db.runQuery(query)
for row in res:
tagPath = row[0]
displayName = row[1]
fieldName = row[2]
unitName = row[3]
foreman = row[4]
tagValue = system.tag.getTagValue("%s/CommStatus" % tagPath)
throughput = system.tag.getTagValue("%s/today_throughput" % tagPath)
newData.append([displayName, tagPath, fieldName, unitName, foreman, tagValue, throughput])
table.data = system.dataset.toDataSet(header, newData)