I like to get a device id from one database in one stream and use this for the id filter in another stream. This is the code that I use but it doesn´t seem to work and gives an error: undefined identifier inputID. I’m still new to using influxdb and was wondering if what I’m trying to do is possible and how I could accomplish this.
My dashboard uses the variable name for most cells but this cell needs an ID that is linked to that name. I try to get the integer of the ID that is coupled to the name in stream1 and use that integer for the ID in stream2. Is it possible to create or fill a local variable in the code?
Ok, so you can query the ID using the name of the record and return it as a scalar value. The example below creates a custom function for returning the inputID. It then uses that function with the name variable as input to store the inputID as a variable. That variable is used to filter the 2nd dataset: