Tickscript get tags value size

As influxdb you can use "SHOW TAG VALUES CARDINALITY ON “dbname” from "measurements “with key =“tagname”” to get how many values in this tag. what if get count of this tag value as variable in Tickscript.
In the Chronograf shows like
* Measurements xxx
* tag1
* value1
* value2
* tag2
and the count of tag1 is 2
I know if I want to use query must use batch. what I need use stream. how to get this count “2” as variable
any suggestions

Hello @dan_Xiuxiu,
Unfortunately Kapacitor is end of life. There isn’t any more engineering support for it anymore and I don’t know the answer.
I recommend upgrading or using Cloud.
Either using tasks or serverless function solution to run your own tasks.