How do I update a "parent" field of data when its children change

Hi all,

Apologies if this is in the wrong place and i also extend an apology for asking what could be deemed as a silly question with a simple answer - I’m brand new to bubble.io and very much enjoying it so far.

I am creating an app that will be used to pull statistics and data from energy storage devices, process them through a backend in several different ways and then throw them up onto a frontend dashboard of sorts. All this is being done through bubble whilst utilising the backend workflows & API for device data POSTs to the app.

The issue I am encountering is quite simple. I have a “Devices” datatype in my bubble database along with a “Sites” datatype. Both the Devices and Sites datatypes have a field in them labeled “Status” which ranges: “OK”, “Warning”, “Error”, “Critical”, “Offline”, “Other”. I have the fields setup so that multiple devices can be assigned to one site, depending on how many devices have to be allocated to a site that require them of course.

Basically, I want the backend to process what the status of each device is at all time or perhaps in 10 minute intervals eg Device_001’s Status is “OK”, Device_002’s Status is “Error” etc. I have worked out the first step (for testing) by simply posting POSTs via Postman to the Bubble API to change the Status of the device (which is planned to be handled by a micro-controller in the future), however I cannot for the life of me figure out how to do the following:

Say a site is assigned two devices, Device_001 and Device_002 in this instance are assigned to Site A. How would I be able to continuously check the status of the Devices and update the Site’s status to reflect the state of the devices?

Obviously if both devices are “OK” then the Site’s status would be “OK” and display as such, however for instance if Device_001’s Status is “OK” and Device_002’s Status is “Error”, how would I actively check for this and update Site A’s Status to “Error” (Reflecting the highest priority Status)?

Please let me know if any of you require any sort of particular imagery for more context as I am aware this is somewhat vague.

ChatGPT has not been my friend when it comes to navigating the many wonders that Bubble has to offer, unfortunately. But you fine souls have saved my life on multiple occasions when reading past user topics requiring help, and for that I humbly thank you.

If in every 10 minutes you are updating the status of the devices connected they need the also make that status to display in your site. One site can have any number of devices connected and displaying their status real time if you are use bubble database.
You need to just need to get data from the backend & display it.

Apologies if I misunderstood

You are already checking it in every 10 minutes

Hi Siddarth, I am not currently checking the status of the devices or sites every 10 minutes as I can’t work out how to do this, I also cannot work out how to update the Site’s Status to reflect the Device’s status. Thank you for your reply! :grinning:

You can schedule a backend workflow.

U need to connect both tables as per your requirement and then display it in the front that’s it :sunglasses: