Weird issue with report script data source (dataset)

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:
	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!


another classic case of the good ol’ post and solve immediately – hope this doesn’t become my thing… but it’s hard to argue with the results…

there be some weird internal issue with how datasources are named/do not get rendered properly with respect to heirarchy/scope…

took a random stab, and just renamed my ‘reasons’ datasource to ‘category delays’…

data['category delays'] = system.dataset.toDataSet(headers,ds_data)
# data['debug'] = data['reasons'].getRowCount()

…perhaps the name ‘reasons’ was clashing with the nested query referenced above?

anyways – hope this helps someone else in the future! :slight_smile: