I'm using code very similar to the example in the manual:nested = data['Area
nested = data['Area Data'].getNestedQueryResults() # Gets results from our parent query
subQuery = nested['Area Details'] # Gets the subquery we want -- there can be more than one
header = ['productName', 'cost', 'triple']
alteredDataset = []
for child in subQuery:
children = child.getCoreResults() # children is a dataset
for row in range(children.rowCount):
valProductName = children.getValueAt(row,'productName')
valCost = children.getValueAt(row,'cost')
valTimesThree = None
if valCost != None:
valTimesThree = 3 * valCost
alteredDataset.append([valProductName,valCost,valTimesThree])
# convert the pydataset to a standard dataset
alteredDataset = system.dataset.toDataSet(header, alteredDataset)
# create a new data source with the altered results
data['Updated Area Details'] = alteredDataset
This example says it is useful for table groups but it doesn't go full circle and show how to use the alteredDataset in the existing table group.
In my case the sub query returns a height in inches like 1.75 from the database table, among other machine settings. I have a script that turns those values in a string for shims that would be used. (1", 0.5", 0.25" in this case). For each product in the schedule I have a sub table that displays the machine settings, but I want it to include the shims string, not the height as a number. I have created the altered dataset and assigned it to a key, but I can't figure out how to get the table group to use the altered dataset. If I simply drag the data key into a table cell, every setup for the day displays the first shim stack.