Hello Everyone, I have successfully pushed my Mendix app on Mindsphere and I am getting live data for last 24 hours as time series chart form. I am showing the state of a machine i.e. running or stop (1 or 0) respectively. I want to calculate the duration for which the machine is running i.e. state=1 from this time series data. How can I do this? Any help is welcome.
You need to find the datapoints where it started to run and where it stopped to run.
If your data is stored in the database, you can do this via xpath, otherwise you may need to sort and filter the list (Sort by timestamp, filter by running status and grab the head of the list)
If you have the two datapoints, you can use the secondsBetween function to get the amount of seconds between the two timestamps (You can also use millisecondsBetween, minutesBetween,...