Unable to retain tags in aggregated new db

Hi,

I have following tick script:

dbrp "iot"."autogen"

var actual = stream
  |from()
    .database('iot')
    .retentionPolicy('autogen')
    .groupBy('deviceid', 'region')
	.measurement('wf')
  |window()
    .period(30m)
    .every(5m)
    .align()
  |mean('us')
    .as('depth')
  |influxDBOut()
    .create()
    .database('iot-calibrated')
    .retentionPolicy('autogen')
    .measurement('distance')

New DB is created however the tags from original db aren’t present anymore in the new db. How do I retain the existing tags in the new db?

I haven’t tested what I’m going to suggest. Someone more experienced will probably reply with the solution later.

You do a group by tags at the beginning but don’t do any in the following nodes. Maybe it’s lost somewhere along the way. You migt need to add |groupBy(*) somewhere.