# system.tag.queryTagHistory issue

**URL:** <https://forum.inductiveautomation.com/t/system-tag-querytaghistory-issue/22537>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [February 13, 2019, 2:07pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-issue/22537 "2019-02-13T14:07:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![enrico.merlo](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@enrico.merlo](https://forum.inductiveautomation.com/u/enrico.merlo)\
**Post date:** [February 13, 2019, 2:07pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-issue/22537/1 "2019-02-13T14:07:23Z")

</div>

Hi everyone,

I have a problem with the scripting function in the object. I use it to retrieve a bunch of historical tags from a database, firing it from a calendar component, once a date has been selected.

Here is the function call I make with the properties I pass in:  
“”"  
_dataSet= system.tag.queryTagHistory(paths=paths\_to\_query, startDate=event.source.date, endDate=event.source.date, returnSize=1, aggregationMode=“lastValue”, returnFormat=‘Wide’, ignoreBadQuality =‘false’)_  
“”"

where:  
paths\_to\_query is the array of tag paths of the tags I want to retrieve  
startDate and endDate are the same, in particular the one selected in the calendar object

I show the dataset retrieved in a table.  
When I query the db selecting a date for which I am sure data have been stored, everything works fine:

 ![Ok](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/627b6c397d0bf1f78a3b7a8ee88987efc7cd732f.jpeg)

when I select a date for which there are no data stored or the gateway was not active, I get some values I don’t understand and a red overlay appears over the table’s fields:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/dd7bd4b837ce3ffae8a7ac9daac37dbd9552def6.png)

The table’s quality property doesn’t change.

In this way, I can’t detect either the query runs fine or not.

Any suggestion?  
Thanks!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 13, 2019, 5:01pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-issue/22537/2 "2019-02-13T17:01:01Z")

</div>

> [@enrico.merlo](#):
>
> ignoreBadQuality =‘false’)

First issue I see - `ignoreBadQuality` expects a boolean (in Python, literally `True` or `False`; `'false'` is just a string.

For detecting a bad quality result - don't look at the table's overall data quality (it would have 'bad' quality if the tag history query itself didn't work) - examine individual row quality using `dataset.getQualityAt(row, col)`.
