What product/components do you use and which version/fix level are you on?
1015.0.218
Is your question related to the free trial, or to a production (customer) instance?
production
What are you trying to achieve? Please describe it in detail.
I have two different events:
Start and Stop
I want to count all stop events if the value is not equal to the start event. There is always a start event before a stop event.
I also could compare two consecutive stop events and count these stops if the delta to the preceding is not 0.
I am trying to solve that with the Analytics Builder.
This is what I tried. But there is always an input to the counter, I think since it is True/False
Regarding your second question: you could use a Pulse block between the Expression and Counter blocks and configure it to fire on “Non-zero Values”. That way it would only trigger the counter, if the Expression results in a “true”:
I am not sure if I completely understand your first question. Do you mean the event flow will always be:
Start → Stop → Start → Stop → …
and you want to compare a value from the a Start event with a value from the following Stop event? Will there never be two subsequent Start or two subsequent Stop events?
For the second question you can use the Delta block to give the difference between two successive values. Send the output to Pulse set to pulse on non-zero values and then send those pulses into the Counter.
For the first question, if the the pairs are sequential, ie. Start, Stop, Start, Stop, …, you should be able to precede the solution below for just Stops with a Combiner block that outputs the Maximum value (assuming they’re all positive), This should alternate between the values from the Start and Stop events on separate inputs.
Alternatively, if the only difference between Start and Stop events is a property, and you know they are always in sequence, you may just be able to feed the values in as is,
An Expression block could extract values from relevant events if the flow isn’t that certain.
I tried your solution but it is not working. Are there any ways to debug the application builder?
Like checking the calculations, the delta or the extract function?
One way is to create a device for debugging. Then you can wire the outputs from any blocks you are interested in, via na output block, to fragments/series on that and graph how they change.
Important is that the mode of Pulse is “On non-zero values” to work as expected. The model takes simulated temperature measurements and counts the ones with a temperature of 15.0. It creates an event with the count as the text.
Second question solved: It worked with the pulse. The problem was in the properties extractor. I did not start with the event type name. The docs could be better here like: c8y_Event.location.city for { “location” : { “city” : “Cambridge” } instead of only location.city.
Overall, better debugging would help.
Regarding the documentation issue, I;ve looked at the code and as afar as I can tell you shouldn’t need to prefix the path with the type. Can I just double-check that for your incoming Events you aren’t also using the type as the root key of the Event’s parameters?