I want to compare the values of two rows in the same resultset. How to achieve this using Flux?
For example, I take the last two rows with tail(2) and want to compare the values of both rows. If the values are equal do nothing, else send a notification.
@skartikey Thank you very much!
But what about if this is a string value and I want to compare details of both strings? difference() does not work on strings.
@skartikey Perfect!
Is it somehow possible to do this in one query?
Or do I need to create separate variables for the first and the last value of the tail(2) result and compare these?
@skartikey
The only problem I have with your solution is r.c1 and r.c2. Can I access the first row with r.c1 and the second one with r.c2 or what is meant with these?
I get the following error message runtime error @8:8-17:6: map: failed to evaluate map function: expected argument "v" to be of type string, got type invalid value {}
@he4d c1 and c2 are just random names I have used for the column. In your case, it will be something else. Use yield function to see the result and use col names from there.
This will give you the results after the pivot function.
To get what I need I need to take the _time as columnKey as I want to compare the old and the new value.
For a better understanding of what I need I added an screenshot of the current result. Please see the notes I wrote to the last two columns.