Hello,
So I worked from the following post to get my Nested Child queries working. Report with Scripted Nested Data
Doing a few named queries using above idea. I am also doing a Historical Query, returning one row. I believe the Underlying Historical Dataset in the Scripting Data source has data(see Wrapper.log below).
I am struggling with how to generically reference a Data source in a Report Designer Table Component, by a Column Index, not an explicit Column Name.
If you follow the Script - Data source below I wind with a Parent- âSelectedRowsâ with a Child âK123Historicalâ
If put in a Default Value for âTagAliasesâ and âTagPensâ in the Data Source, I can graphically drag and drop to build table. When I go and pass in new âTagPensâ and âTagAliasesâ as Report Parameters, the report is still using the Original ones from Default Value for Data Source. I need to not âDrag and Dropâ Explicit Column Names, but somehow refer to a Column Index of the underlying Data Source. This might not be possible?
from system.report import QueryResults
wholeSelectedRows = data['WholeSelectedRows']
parentqr = QueryResults(wholeSelectedRows)
print "!from Reporting Data Source"
aliases= data['TagAliases']
aliasesPyDS = system.dataset.toPyDataSet(aliases)
pySeq = ["t_stamp"]
for row in aliasesPyDS:
for value in row:
pySeq.append(value)
print "pySeq",type(pySeq), pySeq
tagPens = data['TagPens']
tagPensPyDS = system.dataset.toPyDataSet(tagPens)
tagPensPySeq = []
for row in tagPensPyDS:
for value in row:
tagPensPySeq.append('[default]'+value)
print "tagPens",type(tagPensPySeq), tagPensPySeq
childListK123Tstamp = []
for r in range(wholeSelectedRows.rowCount):
K123_Test_ID = wholeSelectedRows.getValueAt(r,"K123_Test_ID")
childDSK123Tstamp = system.db.runNamedQuery("K123XL100","SelectK123TestIDtstamp", {"Test_ID":K123_Test_ID})
date = childDSK123Tstamp.getValueAt(0,0)
newHistoricalData = system.tag.queryTagHistory(paths=tagPensPySeq, startDate=date, endDate=date, returnSize =1,columnNames= pySeq,aggregationMode = "LastValue")
histPyDS = system.dataset.toPyDataSet(newHistoricalData)
print histPyDS
print histPyDS.getColumnNames()
for row in histPyDS:
for value in row:
print value
childListK123Tstamp.append(QueryResults(newHistoricalData, parentqr,r))
parentqr.addNestedQueryResults('K123Historical', childListK123Tstamp)
data['SelectedRows'] = parentqr
Output from Wrapper.log
INFO | jvm 4 | 2018/09/21 12:34:52 | !from Reporting Data Source
INFO | jvm 4 | 2018/09/21 12:34:52 | pySeq <type 'list'> ['t_stamp', u'Punch 1', u'Punch 2', u'Punch 3', u'Punch 4', u'Actual Pre Force']
INFO | jvm 4 | 2018/09/21 12:34:52 | tagPens <type 'list'> [u'[default]K123_XL100/Punch 1', u'[default]K123_XL100/Punch 2', u'[default]K123_XL100/Punch 3', u'[default]K123_XL100/Punch 4', u'[default]K123_XL100/Actual Pre Force']
INFO | jvm 4 | 2018/09/21 12:34:52 | <PyDataset rows:1 cols:6>
INFO | jvm 4 | 2018/09/21 12:34:52 | [t_stamp, Punch 1, Punch 2, Punch 3, Punch 4, Actual Pre Force]
INFO | jvm 4 | 2018/09/21 12:34:52 | 2018-09-21 11:23:51.585
INFO | jvm 4 | 2018/09/21 12:34:52 | 5.3575091362
INFO | jvm 4 | 2018/09/21 12:34:52 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:52 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:52 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:52 | 0.0
INFO | jvm 4 | 2018/09/21 12:34:52 | <PyDataset rows:1 cols:6>
INFO | jvm 4 | 2018/09/21 12:34:52 | [t_stamp, Punch 1, Punch 2, Punch 3, Punch 4, Actual Pre Force]
INFO | jvm 4 | 2018/09/21 12:34:52 | 2018-09-21 11:24:02.191
INFO | jvm 4 | 2018/09/21 12:34:52 | 5.3575091362
INFO | jvm 4 | 2018/09/21 12:34:52 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:52 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:52 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:52 | 0.0
INFO | jvm 4 | 2018/09/21 12:34:53 | <PyDataset rows:1 cols:6>
INFO | jvm 4 | 2018/09/21 12:34:53 | [t_stamp, Punch 1, Punch 2, Punch 3, Punch 4, Actual Pre Force]
INFO | jvm 4 | 2018/09/21 12:34:53 | 2018-09-21 11:24:24.319
INFO | jvm 4 | 2018/09/21 12:34:53 | 5.3575091362
INFO | jvm 4 | 2018/09/21 12:34:53 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:53 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:53 | -0.00999999977648
INFO | jvm 4 | 2018/09/21 12:34:53 | 0.0