Hi All,
Trying to understand why I’m only getting a single row returned from my datasource created by script…
Essentially, I am trying to sum the rows of my nested query, so that I can display a pie chart – was trying to avoid executing a second (non-nested) query to obtain data that I already have…
# combine all of the skip delay reasons into a single datasource for aggregation (e.g. category pie charts, etc)
reasons = data['skip_delay'].getNestedQueryResults()['reasons']
category_delay = {}
for child in reasons:
child_r = child.getCoreResults()
for row in range(child_r.rowCount):
category = child_r.getValueAt(row,'category')
delay = child_r.getValueAt(row,'delay')
if delay:
if category in category_delay:
delay = category_delay[category] + delay
category_delay[category] = delay
headers = ['category','delay']
ds_data = []
for k in category_delay:
ds_data.append([k,category_delay[k]])
data['reasons'] = system.dataset.toDataSet(headers,ds_data)
data['debug'] = data['reasons'].getRowCount()
From here – i would expect the row count of my “reasons” ds to be the same as my “debug” parameter… but for whatever reason – this is what I get:
and in the preview…
Nothing is logged in the output console or gateway logs that I can see…
Perhaps I’m missing something here? Has anyone seen this behaviour before/have troubleshooting tips?
This gateway version is 7.9.1.
Thanks in advance!
-Paul