I have had success adding a nested query to an existing datasource using a scripted datasource, but what I have not been able to do is to add a nested query to an existing nested query.
I have a Query Data Source "Parent Data". It has a Nested Query called "ChildData". When I execute the following:
from system.report import QueryResults
parentData = data['ParentData']
nestedResults = parentData.getNestedQueryResults()
childData = nestedResults['ChildData']
testHeader = ['col1', 'col2']
testData = [[1,2],[3,4]]
testData = system.dataset.toDataSet(testHeader, testData)
childData.addNestedQueryResults('TestData', [QueryResults(testData)])
I get the error "AttributeError: 'array.array' object has no attribute 'addNestedQueryResults'"
I am able to add the testData QueryResults directly to ParentData, but not to ChildData
ie parentData.addNestedQueryResults('TestData', [QueryResults(testData)]) works properly