How to compare the current series of data with previous series using kapacitor (tick script)

Logic looks fine to me. I will run this with actual data.

Meanwhile, can you answer another question, which is at the top of our discussion in the same thread.

var current = stream
|from()
.measurement(‘test’)
.groupBy()
|window()
.period(1m)
.every(1m)

var old = current
|shift(-1m)

|alert()
.id(’/jobs:jobs/telemetry-measurement:measurement/measurement=test/query=test’)
.crit(lambda: ((‘current.tag1’== ‘old.tag1’)AND(‘current.tag2’==‘old.tag2’)AND(‘current.field1’ != ‘old.field1’)))
.log(’/tmp/out.tmp’)

Especially, i had a doubt at lambda condition: there tag1 and tag2 are tags and field1 is the field. And where the single or double quotes can be added…

It required for us to store in one variable and compare with some other values later.

q1: how to use the tags/fields from the variable?
q2: How to compare with plain string with varible’s field?
ex: temp1.field1==“hello”

more information can be find out at How to compare 2 consecutive series of data and the ways to access/compare variables in Tick?

Due to duplicate in the content it is closed.

It is useful for number of our usecases.