# How I can access to points fields on UnionNode

**URL:** <https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612>\
**Category:** Store\
**Tags:** kapacitor\
**Created:** [January 14, 2020, 1:55pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612 "2020-01-14T13:55:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amos\_Guetta](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/amos_guetta/32/4218_2.png) [@Amos\_Guetta](https://community.influxdata.com/u/Amos_Guetta)\
**Post date:** [January 14, 2020, 1:55pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/1 "2020-01-14T13:55:40Z")

</div>

HI,  
I have this TICK script:  
var data = stream  
|from()  
.database(‘counters’)  
.retentionPolicy(‘autogen’)  
.measurement(‘DataCounters’)  
.groupBy(\*)  
|window()  
.periodCount(2)  
.everyCount(1)

var InOctets = data  
|where(lambda: isPresent(“InOctets”))  
|derivative(‘InOctets’)  
.nonNegative()  
.as(‘InOctets’)  
|eval(  
lambda: “InOctets”)  
.as(‘calc\_InOctets’)

var OutOctets = data  
|where(lambda: isPresent(“OutOctets”))  
|derivative(‘OutOctets’)  
.nonNegative()  
.as(‘OutOctets’)  
|eval(  
lambda: “OutOctets”)  
.as(‘calc\_OutOctets’)  
InOctets  
|union(OutOctets)  
|eval(  
lambda: if(“calc\_InOctets” \> 0, 100.0 / “calc\_InOctets”, 0.0))  
.as(‘calc\_NormalizedBandwidth’)  
.keep(‘calc\_OutOctets’)

|influxDBOut()  
.database(‘counters’)  
.retentionPolicy(‘calc\_rp’)  
.measurement(‘DataCounters’)  
.precision(‘ms’)  
.flushInterval(5s)

and I got every time this error: rr=“Failed to handle 2 argument: invalid math operator / for type missing”.  
without the evalNode the Kapacitor saves the right data on influx as expect.

what can be the problem with my TICK script? how I can access to the field after the union?

---

<div class="post-metadata">

**Author:** ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)\
**Post date:** [January 14, 2020, 2:21pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/2 "2020-01-14T14:21:40Z")

</div>

Try this:

```auto
var data = stream
	|from()
		.database('counters')
		.retentionPolicy('autogen')
		.measurement('DataCounters')
		.groupBy(*)
	|window()
		.periodCount(2)
		.everyCount(1)

var InOctets = data
	|where(lambda: isPresent("InOctets"))
	|derivative('InOctets')
		.nonNegative()
		.as('calc_InOctets')
		
var OutOctets = data
	|where(lambda: isPresent("OutOctets"))
	|derivative('OutOctets')
		.nonNegative()
		.as('calc_OutOctets')
	
InOctets
	|union(OutOctets)
	|eval(lambda: if("calc_InOctets" > 0, 100.0 / "calc_InOctets", 0.0))
		.as('calc_NormalizedBandwidth')
		.keep('calc_OutOctets')
	|influxDBOut()
		.database('counters')
		.retentionPolicy('calc_rp')
		.measurement('DataCounters')
		.precision('ms')
		.flushInterval(5s)

```

I think the problem is that you were missing the double quotes around the field name

before:  
lambda: if(“calc\_InOctets” \> 0, 100.0 / **calc\_InOctets** , 0.0))  
after:  
lambda: if(“calc\_InOctets” \> 0, 100.0 / **“calc\_InOctets”** , 0.0))

let me know if this was the problem

---

<div class="post-metadata">

**Author:** ![Amos\_Guetta](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/amos_guetta/32/4218_2.png) [@Amos\_Guetta](https://community.influxdata.com/u/Amos_Guetta)\
**Post date:** [January 14, 2020, 2:24pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/3 "2020-01-14T14:24:10Z")

</div>

Thank for the replay… but this is my mistake on the script I have the double quotes.  
so this is not the problem…

---

<div class="post-metadata">

**Author:** ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)\
**Post date:** [January 14, 2020, 3:13pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/4 "2020-01-14T15:13:10Z")

</div>

I’m not an expert on tick script, but for what I’ve found looks like this error can be caused by missing points.  
Sample:  
A | B  
null | 13  
8 | null

Since the missing point does not have a type you get the error.

To check if this is the case you can add the [httpOut Node](https://docs.influxdata.com/kapacitor/v1.5/nodes/http_out_node/)

```auto
InOctets
	|union(OutOctets)
	|httpOut('_The NameYouWant__')

```

This makes sense since Union just outputs the two datasets as one without modification, you may need to join (and not union) the two different streams in order to have the data on the same “row” and be able to calculate the additional field.

---

<div class="post-metadata">

**Author:** ![Amos\_Guetta](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/amos_guetta/32/4218_2.png) [@Amos\_Guetta](https://community.influxdata.com/u/Amos_Guetta)\
**Post date:** [January 14, 2020, 7:05pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/5 "2020-01-14T19:05:47Z")

</div>

but if I removing the Eval node (this lines,  
|eval(lambda: if(“calc\_InOctets” \> 0, 100.0 / “calc\_InOctets”, 0.0))  
.as(‘calc\_NormalizedBandwidth’)  
.keep(‘calc\_OutOctets’)  
i see all the points on the influxdb, so I dont think there is missing points.

---

<div class="post-metadata">

**Author:** ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)\
**Post date:** [January 14, 2020, 9:04pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/6 "2020-01-14T21:04:41Z")

</div>

Have a look at this [issue on github](https://github.com/influxdata/kapacitor/issues/1788).  
He had the same problem but you can’t see it by querying the data in influx

---

<div class="post-metadata">

**Author:** ![Amos\_Guetta](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/amos_guetta/32/4218_2.png) [@Amos\_Guetta](https://community.influxdata.com/u/Amos_Guetta)\
**Post date:** [January 15, 2020, 1:34pm UTC](https://community.influxdata.com/t/how-i-can-access-to-points-fields-on-unionnode/12612/7 "2020-01-15T13:34:33Z")

</div>

It seems that on HttpOut I received just the InOctets values, and the OutOctets value is missing… but I don’t understand why? because I know we stream this counters … so weird
