# system.tag.queryTagCalculations problem

**URL:** <https://forum.inductiveautomation.com/t/system-tag-querytagcalculations-problem/21844>\
**Category:** Ignition\
**Created:** [January 12, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculations-problem/21844 "2019-01-12T18:41:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan.wiebe](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@dan.wiebe](https://forum.inductiveautomation.com/u/dan.wiebe)\
**Post date:** [January 12, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculations-problem/21844/1 "2019-01-12T18:41:20Z")

</div>

Hi Guys,

I Have a problem using this command.

In script console i have it working properly.

Using a gateway timer script it fails and says cannot multiply nonetype and float. i have done it right in there plus with the project scoped scripts and changed alot of other things to see if it was not returning any data. it is returning a row but the get value at is not returning a float like it does in the script console so im sure im missing something with the scoping?

Its meant to average the flow rate time weighted so i can calculate a rough strokes count for each day.

it errors out at "e = b \* mult" saying it cant multiply nonetype and float in the gloabal timer script but it works in script console.

> Blockquote  
> def yday(fldr, s):  
> pathx = str(fldr + "/PUMP" + s + "_FLOWRATE")  
> pathy = str(fldr + "/VOL\_PER\_STROKE_" + s)  
> pathz = str(fldr + "/PUMP" + s + "\_STROKE\_YD")  
> mult = 1000.0  
> b = 0.0  
> d = 0.0  
> a = system.tag.queryTagCalculations(paths=[pathx], calculations=['Average'], rangeHours=24)  
> if a.rowCount \> 0:  
> b = a.getValueAt(0,1)  
> e = b \* mult  
> c = system.tag.queryTagCalculations(paths=[pathy], calculations=['Average'], rangeHours=24, noInterpolation=True, ignoreBadQuality=True)  
> d = c.getValueAt(0,1)  
> if d \< 0.76418:  
> d = system.tag.read(pathy).value  
> if d \< 0.76418:  
> d = 0.76418  
> f = e / d  
> system.tag.write(pathz, f)

---

<div class="post-metadata">

**Author:** ![Brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@Brian](https://forum.inductiveautomation.com/u/Brian)\
**Post date:** [January 12, 2019, 7:18pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytagcalculations-problem/21844/2 "2019-01-12T19:18:54Z")

</div>

You probably need to add the provider to the tag path when running your script on the gateway. It should be something like [nameOfHistoryProviderHere] added to the beginning of the tag path.

Also, format your code with triple backquotes ``` one set on a line before, and one set on a line after, to preserve the formatting.
