How to use values from tag fields in TICK scripts

Hi all,

I have been searching all over the internet for a way to generate an alert based on a value from a field (ie ppm CO2) and a value from a tag field, minValue (which resides in the same row of the influxdb-measurement) and is constant for each id (id is the datapoint on which i filter my initial resultset on)

measurement
time | tag: id | tag: minValue | … (a bunch of other tags) | field: value

My current script looks like this (although i’ve been trying out anything i could find on forums)

var current = stream
|from()
.database(database)
.measurement(site)
.where(lambda: “id” == topic)
|groupBy(‘minValue’)
|window()
.period(60s)
.every(50s)
.align()
|log()
|eval(lambda: “value” - “minimum”)
.as(‘netValue’)
|alert()
.id(‘ValueTooLow’)
.message(‘Value too low’)
.info(lambda: “netValue” > 0)
.warn(lambda: “netValue” == 0)
.crit(lambda: “netValue” < 0)
.stateChangesOnly()
.log(’/tmp/ValueTooLow.txt’)
.post()
.endpoint(‘alertservice’)

my log node (see below) does output the value so it would seem strange if i would not be able to use this value

2019-08-05T15:54:07.576+02:00
kapacitor
begin batch

2019-08-05T15:54:07.576+02:00
Kapacitor Point
9 TAGS
EquipRef: BLABLA
co2: 1
id: TESTID
kind: Number
maxValue: 2000
minValue: 0
point: 1
sensor: 1
unit: ppm
1 FIELDS
value: 800

2019-08-05T15:54:07.578+02:00
kapacitor
end batch
2019-08-05T15:54:07.578+02:00
Kapacitor
ERROR: error evaluating expression