Script Datasource - Reading Tag Historian Query results in Reporting Module 6.1.25

Ignition: 8.1.25
Reporting Module: 6.1.25
Historian: IgnitionDB01 (MSSQL)

Setup:

  • Tag Historian Query data key named ITLoad_Start
  • Tag paths added by dragging from IgnitionDB01 historian browser
  • Script datasource named ITLoad_Calculated tries to read from ITLoad_Start

Current code:
startDs = data['ITLoad_Start'].getCoreResults()
rowCount = startDs.getRowCount() # returns 0
value = startDs.getValueAt(0, 'kul12_reporting/dpm/l1/pdu_l1_n1/energy/kwh') #
returns nothing

Problem:

  • No script errors
  • getCoreResults() returns a dataset object
  • getRowCount() returns 0 even though historian has data
  • Preview shows empty table
  • Parameters StartDate and EndDate have default values set
  • Tag paths confirmed correct format from dragging

Questions:

  1. Is getCoreResults() the correct method to access Tag Historian Query results?
  2. Why does getRowCount() return 0?
  3. What is the correct column name format to use in getValueAt()?
  4. Is there a working example of Script datasource reading from Tag Historian Query?

Your help is much appreciated.
Thanks!

getCoreResults Is the correct method to access the results of a query type parameter in reporting.

Based on the fact that your table is showing as empty in preview, I would say that your tag history query is returning no rows. getRowCount() returning 0 would support with this.

Double check the parameter values being fed to the tag history query. Are you defining valid start/end times to the query? Is there actually data for the time span you are querying? Are you correctly feeding the parameter values to the query?

Also, post code as preformatted text to make it easier for others to review, please see Wiki - how to post code on this forum.