[SOLVED] queryTagCalculations returning BasicStreamingDataset

Hi all,

I have the following function in a script in the datasources for a report

def getMinMaxInverterData(date0,date1):

  numInverters = system.tag.read("Calculations/Device Quantities/PCS").value
  tagPaths = []
  inverterList = []
  for i in range(1,numInverters + 1):
  	tagPaths.append("PCSs/PCS " + str(i) + "/Inverter/AC Energy Total/Scaled Value")
  	inverterList.append("PCS " + str(i) + " Inverter")
  calculation = ["Minimum", "Maximum"]
  inverterData = system.tag.queryTagCalculations(
  	paths = tagPaths, 
  	aliases = inverterList, 
  	calculations = calculation, 
  	startDate = date0, 
  	endDate = date1
  return inverterData

The type of the returned value is “class com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset”.
When I try to access a value in the dataset in order to do further calculations on it, the value is NoneType.

Performing the same calculations in the script console returns a regular dataset, and I get no errors.

Has anyone else encountered this type of issue before?


Removing the assignment to “aliases” seems to have solved the problem. However, now the tagpath column just has “Scaled Value” over and over. This might be an ignition bug, unless someone can point out to me how/where I misspelled something.

EDIT: Removing the assignment to aliases got rid of the error popup, but my return data is still bad. Haven’t solved this one yet.

What is the rowCount of the dataset that you get in the reporting script? You may need use the full tag paths, and include the tag provider.

Sorry for the late reply. The rowcount for the returned dataset was correct. The solution to this, in the end, was to use full tagpaths (including the provider name).

On a related note, nearby my report viewer I had a button which ran a nearly identical script , but used the data to produce a csv instead. After the most recent java/ignition updates, I for some reason had to change the provider from “[default]” to “[~]” in every place where I called queryTagCalculations. In the same script, I had some calls to queryTagHistory, and those only work when the provider is “[default]”; they do not work with “[~]”.

Not sure if this is a bug or a misunderstanding on my part.

We should start using tag provider names across all of our applications.

When doing queries against the tag historian keep in mind the correct format is [historyProviderName]path/to/tag

Using [~] is relative to the Tag provider of the Tag that is being bound (root node). I believe this works for realtime or historical bindings. See the update below

In 7.9.2 they changed the way that tag history paths are parsed:

SQLTags Fixed Inconsistencies with path interpretation causing confusion with tag history and issues with remote historian providers.

This is related to a known issue that has been fixed for version 7.9.3