Report Scripting: Accessing Nested Query with Nested Query

I’m working on a report that has two layers of nested queries. I’m having trouble accessing the nested query on the second tier within the scripting data source. Does anyone have an idea how to go about this?

If you are accessing nested data, look at the docs:

https://docs.inductiveautomation.com/display/DOC80/Scripting+Data+Source#ScriptingDataSource-NestedQueries

If you want to construct nested data, look at this topic:

I have been able to access the first layer of the nested query looking at this documentation. However, I’m having trouble accessing the second layer of the nested query in the report scripting. In this case, the RUN_NUM subquery.

Did you ever figure out how to access the sub-level child queries via scripting? I am trying to accomplish this but I cannot figure out the syntax. Currently I have what is shown in the Scripting Data Source page but I included a nested for loop for the sub-level child query.

The furthest I get is an error ‘TypeError: array.array indices must be integers’ when I write:

	nested = data['NestedQuery_Parent'].getNestedQueryResults() # Gets results from our parent query
	childQuery = nested['Child_Query']  # Gets the subquery we want -- there can be more than one
	subchildQuery = childQuery['subChild_Query'].getNestedQueryResults()

where my Nested queries are in the order:
NestedQuery_Parent
-Child_Query
–subChild_Query